diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b9f34840123b1a3034e967f2175056a3b6215cc..49e64815df8e4971375f1f1e2fb69e8324dc9180 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ image: gradle:alpine stages: - build - test + - pages - deploy variables: @@ -14,8 +15,7 @@ before_script: build: stage: build script: - - mv src/test/resources/martserver-plugins ~/martserver-plugins/ - - gradle build + - gradle assemble - gradle updateSiteZip artifacts: paths: @@ -29,13 +29,14 @@ test: script: - mv src/test/resources/martserver-plugins ~/martserver-plugins/ - gradle check + - cat build/reports/jacoco/index.html artifacts: paths: - build/reports/ - config/html/ pages: - stage: deploy + stage: pages script: - mkdir public - mv config/html/* public @@ -53,7 +54,9 @@ upload: script: - gradle upload only: - - master + - tags + except: + - branches after_script: - echo "End CI" diff --git a/README.md b/README.md index 65ad87dee410d3df2644808124f3bd709720cd04..dbac22d48f59f80f10c1e2e1cc37480800c71384 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # MOCCI [](https://gitlab.gwdg.de/rwm/de.ugoe.cs.rwm.mocci/commits/master) +[](https://gitlab.gwdg.de/rwm/de.ugoe.cs.rwm.mocci/commits/master) MOCCI is an extension for the [Open Cloud Computing Interface (OCCI)](http://occi-wg.org/about/specification/) to enable a model-driven management of monitoring devices in the cloud, as well as storing their results within an OCCI-compliant runtime model. Together with other tools from the OCCI ecosystem it provides a testing and execution environment for self-adaptive systems with an EMF-based architecture runtime model ([Snapshot in JSON format](./doc/browser.png)). In the following you will find a getting started guide in which a preconfigured VirtualBox image is downloaded to perform example scenarios and an tutorial on how to enrich existing OCCI models with monitoring functionality. Moreover, an introduction to MOCCI's components is provided, as well as links and description on how to integrate MOCCI with other pre-existing tooling from the OCCI ecosystem. The paper submitted to this artifact and the VirtualBox image can be found [here](https://owncloud.gwdg.de/index.php/s/5u2ddnyyNlzecM5) with the password being mocci. diff --git a/build.gradle b/build.gradle index 8d9ff43d2123f48cd65818557bfb7f85c47bb6b5..d877423417fa77b3a9c15d4edc81edc7bd6ccb5d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,27 +1,13 @@ -// Apply the java-library plugin to add support for Java Library -apply plugin: 'eclipse' -apply plugin: 'java' -apply plugin: 'checkstyle' -apply plugin: 'findbugs' -apply plugin: 'maven' -apply plugin: "com.github.psxpaul.execfork" apply plugin: 'jacoco' +apply plugin: "com.github.psxpaul.execfork" apply plugin: 'com.github.johnrengelman.shadow' - -subprojects { - apply plugin: 'java' - - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - - +ext{ + tocciVersion = '1.0.1' + docciVersion = '1.0.1' + cocciVersion = '1.0.0' } - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - - buildscript { repositories { maven { @@ -34,6 +20,60 @@ buildscript { } } + +allprojects { + apply plugin: 'java' + apply plugin: 'eclipse' + apply plugin: 'maven' + + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + + repositories { + + mavenCentral() + maven { + url "https://nexus.informatik.uni-goettingen.de/content/repositories/thirdparty/" + } + maven { + url "https://nexus.informatik.uni-goettingen.de/content/repositories/rwm/" + } + } + + javadoc { + source = sourceSets.main.allJava + classpath = configurations.compile + failOnError = true + } +} + +configure([project(':de.ugoe.cs.rwm.mocci.connector'), project(':de.ugoe.cs.rwm.mocci.connector.dummy'), rootProject]) { + apply plugin: 'checkstyle' + apply plugin: 'findbugs' + + checkstyle { + toolVersion = '8.2' + configFile = rootProject.file('config/checkstyle/checkstyle.xml') + configProperties = [ + 'checkstyle.cache.file': "${buildDir}/checkstyle.cache", + ] + ignoreFailures = false + showViolations = true + } + + findbugs { + sourceSets = [sourceSets.main] + ignoreFailures = true + } + + tasks.withType(FindBugs) { + reports { + xml.enabled false + html.enabled true + } + } +} + sourceSets { startMartServer { resources { @@ -44,39 +84,12 @@ sourceSets { eclipse.classpath.file.beforeMerged{ classpath -> classpath.entries.clear() } -// In this section you declare where to find the dependencies of your project -repositories { - // Use jcenter for resolving your dependencies. - // You can declare any Maven/Ivy/file repository here. - //mavenLocal() - mavenCentral() - jcenter() - maven { - url "https://nexus.informatik.uni-goettingen.de/content/repositories/thirdparty/" - } - maven { - url "https://nexus.informatik.uni-goettingen.de/content/repositories/rwm/" - } -} - -dependencies { - //Nexus - compile "org.eclipse.uml2:org.eclipse.uml2.uml:4.1.2" - //runtime? - compile "org.eclipse.uml2:org.eclipse.uml2.types:1.1.0" - compile "org.eclipse.uml2:org.eclipse.uml2.common:1.8.2" - compile group: 'org.eclipse.ocl', name: 'pivot', version: '1.3.0' - +dependencies { //occiware compile group: 'org.eclipse.cmf.occi', name: 'core', version: '1.0.0' compile group: 'org.eclipse.cmf.occi', name: 'infrastructure', version: '1.0.0' - //own - compile group: 'de.ugoe.cs.rwm', name: 'cocci', version: '1.0.0' - compile group: 'de.ugoe.cs.rwm', name: 'docci', version: '1.0.0' - compile group: 'de.ugoe.cs.rwm', name: 'tocci', version: '1.0.0' - compile group: 'de.ugoe.cs.rwm.mocci', name: 'model', version: '1.0.0' - //compile project(':de.ugoe.cs.rwm.mocci.model') - //modmacao + compile group: 'org.eclipse.cmf.occi', name: 'crtp', version: '1.0.0' + compile group: 'org.modmacao', name: 'core', version: '1.0.0' compile group: 'org.modmacao', name: 'placement', version: '1.0.0' compile group: 'org.modmacao.occi', name: 'platform', version: '1.0.0' @@ -84,6 +97,15 @@ dependencies { compile group: 'org.modmacao.openstack.swe', name: 'runtime', version: '1.0.0' compile group: 'org.modmacao', name: 'ansible', version: '1.0.0' + + //own + compile group: 'de.ugoe.cs.rwm', name: 'cocci', version: cocciVersion + compile group: 'de.ugoe.cs.rwm', name: 'docci', version: docciVersion + compile group: 'de.ugoe.cs.rwm', name: 'tocci', version: tocciVersion + compile group: 'de.ugoe.cs.rwm.pog', name: 'model', version: '1.0.0' + //compile group: 'de.ugoe.cs.rwm.mocci', name: 'model', version: '1.0.0' + compile project(':de.ugoe.cs.rwm.mocci.model') + //maven compile group: 'log4j', name: 'log4j', version: '1.2.17' compile group: 'com.google.guava', name: 'guava', version: '25.1-jre' @@ -92,10 +114,14 @@ dependencies { compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1' compile group: 'com.jcraft', name: 'jsch', version: '0.1.54' + //Nexus + compile "org.eclipse.uml2:org.eclipse.uml2.uml:4.1.2" + //runtime? + compile "org.eclipse.uml2:org.eclipse.uml2.types:1.1.0" + compile "org.eclipse.uml2:org.eclipse.uml2.common:1.8.2" + compile group: 'org.eclipse.ocl', name: 'pivot', version: '1.3.0' + testCompile group: 'junit', name: 'junit', version: '4.12' - compile group: 'de.ugoe.cs.rwm.pog', name: 'model', version: '1.0.0' - compile group: 'de.ugoe.cs.rwm.pcg', name: 'model', version: '1.0.0' - //testImplementation 'junit:junit:4.12' } @@ -118,7 +144,6 @@ project(':de.ugoe.cs.rwm.mocci.connector.dummy') { } } - jar { manifest { attributes 'Main-Class': 'de.ugoe.cs.rwm.mocci.MAPE' @@ -128,16 +153,9 @@ jar { tasks.shadowJar.dependsOn("build") configurations.all { - // Check for updates every build - //resolutionStrategy.cacheChangingModulesFor 0, 'seconds' resolutionStrategy.preferProjectModules() } -javadoc { - source = sourceSets.main.allJava - classpath = configurations.compile - failOnError = true -} test { exclude 'de/ugoe/cs/rwm/mocci/live/**' //exclude 'de/ugoe/cs/rwm/mocci/**' @@ -159,32 +177,12 @@ jacocoTestReport { csv.enabled false html.destination file("${buildDir}/reports/jacoco") } -} - -findbugs { - sourceSets = [sourceSets.main] - ignoreFailures = true -} - -checkstyle { - toolVersion = "8.7" - sourceSets = [sourceSets.main] -} - -checkstyleMain { - ignoreFailures = true -} - -tasks.withType(FindBugs) { - reports { - xml.enabled false - html.enabled true - } } task startMartServer(type: com.github.psxpaul.task.JavaExecFork) { classpath = files("src/test/resources/org.occiware.mart.jetty.jar") main = 'org.occiware.mart.jetty.MartServer' + standardOutput = "$buildDir/mart.log" waitForPort = 8080 stopAfter = test } diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index a2566db62204b93a1396208e15d31e0a9220f060..dfb6e35546c792eb2acfc9236ba9469c0c763ca4 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -4,9 +4,6 @@ "http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd"> <module name="Checker"> <property name="charset" value="UTF-8"/> - <module name="JavadocPackage"/> - - <module name="TreeWalker"> <module name="RegexpSinglelineJava"> <property name="format" value="^\t* "/> @@ -32,10 +29,6 @@ <property name="allowByTailComment" value="true"/> <property name="allowNonPrintableEscapes" value="true"/> </module> - <module name="LineLength"> - <property name="max" value="150"/> - <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/> - </module> <module name="OneTopLevelClass"/> <module name="NeedBraces"/> <module name="NoLineWrap"/> diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/build.gradle b/de.ugoe.cs.rwm.mocci.connector.dummy/build.gradle index 65d47fcfa65a2c2b4c25154ae681840af0d9161a..95649a6ae243a5d0cba9fb8ffe11f2f575a586d0 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/build.gradle +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/build.gradle @@ -1,49 +1,18 @@ -// Apply the java-library plugin to add support for Java Library -apply plugin : 'eclipse' -apply plugin: 'java' -apply plugin: 'maven' - - -// In this section you declare where to find the dependencies of your project -repositories { - // Use jcenter for resolving your dependencies. - // You can declare any Maven/Ivy/file repository here. - //mavenLocal() - mavenCentral() - - maven { - url "https://nexus.informatik.uni-goettingen.de/content/repositories/thirdparty/" - } - maven { - url "https://nexus.informatik.uni-goettingen.de/content/repositories/rwm/" - } -} - dependencies { - -//Require-Bundle: org.eclipse.core.runtime, -// org.eclipse.emf.ecore;visibility:=reexport, - - //org.eclipse.ocl.examples.codegen;visibility:=reexport, - //Nexus compile group: 'org.eclipse.ocl', name: 'pivot', version: '1.3.0' - //compile group: 'de.ugoe.cs.rwm.wocci', name: 'model', version: '1.0.0' //occiware compile group: 'org.eclipse.cmf.occi', name: 'core', version: '1.0.0' compile group: 'org.modmacao.occi', name: 'platform', version: '1.0.0' compile group: 'org.modmacao', name: 'cm', version: '1.0.0' compile group: 'org.modmacao.core', name: 'connector', version : '1.0.0' compile group: 'commons-io', name: 'commons-io', version: '2.6' - - - + //maven compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' - compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore', version: '2.15.0' + compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore', version: '2.15.0' compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore.xmi', version: '2.15.0' - testCompile group: 'junit', name: 'junit', version: '4.12' } diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ComponentManager.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ComponentManager.java index 3b8d3e18387260ea8938302fb05ec4616bb585b8..501c2434a4a71c37ea061d0d294f4457d012e4d5 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ComponentManager.java +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ComponentManager.java @@ -1,161 +1,142 @@ -package de.ugoe.cs.rwm.mocci.connector; +/** + * Copyright (c) 2018-2019 University of Goettingen + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> + */ -import java.util.LinkedList; -import java.util.List; +package de.ugoe.cs.rwm.mocci.connector; -import org.eclipse.cmf.occi.core.Link; -import org.eclipse.cmf.occi.core.MixinBase; -import org.modmacao.cm.ConfigurationManagementTool; -import org.modmacao.cm.ansible.AnsibleCMTool; import org.modmacao.occi.platform.Component; import org.modmacao.occi.platform.Status; - public class ComponentManager { private Component comp; - + public ComponentManager(Component comp) { this.comp = comp; } - public void undeploy() { - switch(comp.getOcciComponentState().getValue()) { - - case Status.ACTIVE_VALUE: - - comp.stop(); - comp.setOcciComponentState(Status.UNDEPLOYED); - break; + switch (comp.getOcciComponentState().getValue()) { + case Status.ACTIVE_VALUE: - case Status.INACTIVE_VALUE: - comp.setOcciComponentState(Status.UNDEPLOYED); - break; - + comp.stop(); + comp.setOcciComponentState(Status.UNDEPLOYED); + break; - case Status.DEPLOYED_VALUE: - comp.setOcciComponentState(Status.UNDEPLOYED); - break; + case Status.INACTIVE_VALUE: + comp.setOcciComponentState(Status.UNDEPLOYED); + break; + case Status.DEPLOYED_VALUE: + comp.setOcciComponentState(Status.UNDEPLOYED); + break; - case Status.ERROR_VALUE: - comp.setOcciComponentState(Status.UNDEPLOYED); - break; + case Status.ERROR_VALUE: + comp.setOcciComponentState(Status.UNDEPLOYED); + break; - default: - break; + default: + break; } } + // End of user code // Start of user code Publisher_Kind_deploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: deploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: deploy - + * title: */ - public void deploy() - { - int status = -1; + public void deploy() { // Component State Machine. - switch(comp.getOcciComponentState().getValue()) { + switch (comp.getOcciComponentState().getValue()) { case Status.UNDEPLOYED_VALUE: comp.setOcciComponentState(Status.DEPLOYED); break; - + default: break; -} + } } + // End of user code // Start of user code Publisher_Kind_configure_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: configure - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: configure + * - title: */ - public void configure() - { - int status = -1; + public void configure() { // Component State Machine. - switch(comp.getOcciComponentState().getValue()) { + switch (comp.getOcciComponentState().getValue()) { case Status.DEPLOYED_VALUE: - comp.setOcciComponentState(Status.INACTIVE); + comp.setOcciComponentState(Status.INACTIVE); break; - + default: break; -} + } } + // End of user code // Start of user code Publisher_Kind_Start_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: start - * - title: Start the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: start - + * title: Start the application. */ - public void start() - { - int status = -1; + public void start() { // Component State Machine. - switch(comp.getOcciComponentState().getValue()) { + switch (comp.getOcciComponentState().getValue()) { case Status.INACTIVE_VALUE: - comp.setOcciComponentState(Status.ACTIVE); + comp.setOcciComponentState(Status.ACTIVE); break; - case Status.UNDEPLOYED_VALUE: - comp.setOcciComponentState(Status.ERROR); - break; + comp.setOcciComponentState(Status.ERROR); + break; default: break; -} + } } + // End of user code // Start of user code Publisher_Kind_Stop_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: stop - * - title: Stop the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: stop - + * title: Stop the application. */ - public void stop() - { - int status = -1; + public void stop() { // Component State Machine. - switch(comp.getOcciComponentState().getValue()) { + switch (comp.getOcciComponentState().getValue()) { case Status.ACTIVE_VALUE: - + comp.setOcciComponentState(Status.INACTIVE); - + break; default: break; -} + } } // End of user code - - private boolean assertCompsStatusEquals(List<Component> components, Status status) { - for (Component component: components) { - if (component.getOcciComponentState().getValue() != status.getValue()) { - return false; - } - } - return true; -} - -} \ No newline at end of file + +} \ No newline at end of file diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ConnectorFactory.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ConnectorFactory.java index c9f4312a2cf97d761b4a29c4e6d9b29530ad7c54..3f587b6fb3d05c5e4e1737dbe4c91e7f1d6f9d34 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ConnectorFactory.java +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ConnectorFactory.java @@ -1,33 +1,29 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Thu Jan 03 13:17:39 CET 2019 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ -package de.ugoe.cs.rwm.mocci.connector; -import monitoring.Dataprocessor; +package de.ugoe.cs.rwm.mocci.connector; /** - * Connector EFactory for the OCCI extension: - * - name: monitoring - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# + * Connector EFactory for the OCCI extension: - name: monitoring - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# */ -public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl -{ +public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl { /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: sensor - * - title: Sensor Component + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: sensor - title: Sensor + * Component */ @Override public monitoring.Sensor createSensor() { @@ -35,10 +31,9 @@ public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl } /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: datagatherer - * - title: DataGatherer Resource + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: datagatherer - title: + * DataGatherer Resource */ @Override public monitoring.Datagatherer createDatagatherer() { @@ -46,10 +41,9 @@ public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl } /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: processor - * - title: Processor Resource + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: processor - title: Processor + * Resource */ @Override public monitoring.Dataprocessor createDataprocessor() { @@ -57,10 +51,9 @@ public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl } /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: publisher - * - title: Publisher Resource + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: publisher - title: Publisher + * Resource */ @Override public monitoring.Resultprovider createResultprovider() { @@ -68,22 +61,19 @@ public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl } /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: martpublisher - * - title: MartPublisher Mixin + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: martpublisher - title: + * MartPublisher Mixin */ @Override public monitoring.Occiresultprovider createOcciresultprovider() { return new OcciresultproviderConnector(); } - /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: monitoringproperty - * - title: MonitoringProperty Component + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: monitoringproperty - title: + * MonitoringProperty Component */ @Override public monitoring.Monitorableproperty createMonitorableproperty() { diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/DatagathererConnector.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/DatagathererConnector.java index a645fc41a5a6673d66b850cb6175545c422a614a..1cbfc6360a96e691338fda55ca6d7ae43989d731 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/DatagathererConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/DatagathererConnector.java @@ -1,33 +1,30 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Wed Dec 19 10:30:40 CET 2018 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; import org.modmacao.occi.platform.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: datagatherer - * - title: DataGatherer Resource + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: datagatherer - title: + * DataGatherer Resource */ -public class DatagathererConnector extends monitoring.impl.DatagathererImpl -{ +public class DatagathererConnector extends monitoring.impl.DatagathererImpl { /** * Initialize the logger. */ @@ -37,8 +34,7 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl /** * Constructs a datagatherer connector. */ - DatagathererConnector() - { + DatagathererConnector() { LOGGER.debug("Constructor called on " + this); // TODO: Implement this constructor. } @@ -46,14 +42,13 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl // // OCCI CRUD callback operations. // - + // Start of user code DatagathererocciCreate /** * Called when this Datagatherer instance is completely created. */ @Override - public void occiCreate() - { + public void occiCreate() { LOGGER.debug("occiCreate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -64,8 +59,7 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl * Called when this Datagatherer instance must be retrieved. */ @Override - public void occiRetrieve() - { + public void occiRetrieve() { LOGGER.debug("occiRetrieve() called on " + this); // TODO: Implement this callback or remove this method. } @@ -76,8 +70,7 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl * Called when this Datagatherer instance is completely updated. */ @Override - public void occiUpdate() - { + public void occiUpdate() { LOGGER.debug("occiUpdate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -88,8 +81,7 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl * Called when this Datagatherer instance will be deleted. */ @Override - public void occiDelete() - { + public void occiDelete() { LOGGER.debug("occiDelete() called on " + this); // TODO: Implement this callback or remove this method. } @@ -101,128 +93,116 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl // Start of user code Datagatherer_Kind_configure_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: configure - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: configure + * - title: */ @Override - public void configure() - { + public void configure() { LOGGER.debug("Action configure() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.DEPLOYED_VALUE: - this.setOcciComponentState(Status.INACTIVE); + this.setOcciComponentState(Status.INACTIVE); break; - + default: break; } } + // End of user code // Start of user code Datagatherer_Kind_deploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: deploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: deploy - + * title: */ @Override - public void deploy() - { + public void deploy() { LOGGER.debug("Action deploy() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.UNDEPLOYED_VALUE: this.setOcciComponentState(Status.DEPLOYED); break; - + default: break; } } + // End of user code // Start of user code Datagatherer_Kind_undeploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: undeploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: undeploy + * - title: */ @Override - public void undeploy() - { + public void undeploy() { LOGGER.debug("Action undeploy() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.ACTIVE_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; - case Status.INACTIVE_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; - case Status.DEPLOYED_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; - case Status.ERROR_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; default: break; -} + } } + // End of user code // Start of user code Datagatherer_Kind_Stop_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: stop - * - title: Stop the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: stop - + * title: Stop the application. */ @Override - public void stop() - { + public void stop() { LOGGER.debug("Action stop() called on " + this); setOcciComponentState(Status.INACTIVE); } + // End of user code // Start of user code Datagatherer_Kind_Start_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: start - * - title: Start the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: start - + * title: Start the application. */ @Override - public void start() - { + public void start() { LOGGER.debug("Action start() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.INACTIVE_VALUE: - this.setOcciComponentState(Status.ACTIVE); + this.setOcciComponentState(Status.ACTIVE); break; - case Status.UNDEPLOYED_VALUE: - this.setOcciComponentState(Status.ACTIVE); - break; + this.setOcciComponentState(Status.ACTIVE); + break; default: break; - - } + + } } // End of user code - - -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/DataprocessorConnector.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/DataprocessorConnector.java index 4271abf538682e34099927ecdde658831c9a09e4..460c5022fcf38d7cf6130eeaa70aa3f44d581428 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/DataprocessorConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/DataprocessorConnector.java @@ -1,34 +1,30 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Wed Dec 19 10:30:40 CET 2018 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; -import org.eclipse.cmf.occi.core.AttributeState; import org.modmacao.occi.platform.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: processor - * - title: Processor Resource + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: processor - title: Processor + * Resource */ -public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl -{ +public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl { /** * Initialize the logger. */ @@ -38,8 +34,7 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl /** * Constructs a processor connector. */ - DataprocessorConnector() - { + DataprocessorConnector() { LOGGER.debug("Constructor called on " + this); // TODO: Implement this constructor. } @@ -47,14 +42,13 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl // // OCCI CRUD callback operations. // - + // Start of user code ProcessorocciCreate /** * Called when this Processor instance is completely created. */ @Override - public void occiCreate() - { + public void occiCreate() { LOGGER.debug("occiCreate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -65,8 +59,7 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl * Called when this Processor instance must be retrieved. */ @Override - public void occiRetrieve() - { + public void occiRetrieve() { LOGGER.debug("occiRetrieve() called on " + this); // TODO: Implement this callback or remove this method. } @@ -77,8 +70,7 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl * Called when this Processor instance is completely updated. */ @Override - public void occiUpdate() - { + public void occiUpdate() { LOGGER.debug("occiUpdate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -89,8 +81,7 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl * Called when this Processor instance will be deleted. */ @Override - public void occiDelete() - { + public void occiDelete() { LOGGER.debug("occiDelete() called on " + this); // TODO: Implement this callback or remove this method. } @@ -102,128 +93,116 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl // Start of user code Processor_Kind_configure_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: configure - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: configure + * - title: */ @Override - public void configure() - { + public void configure() { LOGGER.debug("Action configure() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.DEPLOYED_VALUE: - this.setOcciComponentState(Status.INACTIVE); + this.setOcciComponentState(Status.INACTIVE); break; - + default: break; } } + // End of user code // Start of user code Processor_Kind_deploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: deploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: deploy - + * title: */ @Override - public void deploy() - { + public void deploy() { LOGGER.debug("Action deploy() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.UNDEPLOYED_VALUE: this.setOcciComponentState(Status.DEPLOYED); break; - + default: break; } } + // End of user code // Start of user code Processor_Kind_undeploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: undeploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: undeploy + * - title: */ @Override - public void undeploy() - { + public void undeploy() { LOGGER.debug("Action undeploy() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.ACTIVE_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; - case Status.INACTIVE_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; - case Status.DEPLOYED_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; - case Status.ERROR_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; default: break; -} + } } + // End of user code // Start of user code Processor_Kind_Stop_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: stop - * - title: Stop the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: stop - + * title: Stop the application. */ @Override - public void stop() - { + public void stop() { LOGGER.debug("Action stop() called on " + this); setOcciComponentState(Status.INACTIVE); } + // End of user code // Start of user code Processor_Kind_Start_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: start - * - title: Start the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: start - + * title: Start the application. */ @Override - public void start() - { + public void start() { LOGGER.debug("Action start() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.INACTIVE_VALUE: - this.setOcciComponentState(Status.ACTIVE); + this.setOcciComponentState(Status.ACTIVE); break; - case Status.UNDEPLOYED_VALUE: - this.setOcciComponentState(Status.ACTIVE); - break; + this.setOcciComponentState(Status.ACTIVE); + break; default: break; - - } + + } } // End of user code - - -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/MonitorablepropertyConnector.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/MonitorablepropertyConnector.java index ac8d9a601124de874d57ee214923ebb0d7b44154..eac5d69a2a5b3fbae95f77533c66ab552347b5ad 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/MonitorablepropertyConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/MonitorablepropertyConnector.java @@ -1,32 +1,29 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Thu Jan 03 13:17:39 CET 2019 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: monitoringproperty - * - title: MonitoringProperty Component + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: monitoringproperty - title: + * MonitoringProperty Component */ -public class MonitorablepropertyConnector extends monitoring.impl.MonitorablepropertyImpl -{ +public class MonitorablepropertyConnector extends monitoring.impl.MonitorablepropertyImpl { /** * Initialize the logger. */ @@ -36,8 +33,7 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro /** * Constructs a monitoringproperty connector. */ - MonitorablepropertyConnector() - { + MonitorablepropertyConnector() { LOGGER.debug("Constructor called on " + this); // TODO: Implement this constructor. } @@ -45,14 +41,13 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro // // OCCI CRUD callback operations. // - + // Start of user code MonitoringpropertyocciCreate /** * Called when this Monitoringproperty instance is completely created. */ @Override - public void occiCreate() - { + public void occiCreate() { LOGGER.debug("occiCreate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -63,8 +58,7 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro * Called when this Monitoringproperty instance must be retrieved. */ @Override - public void occiRetrieve() - { + public void occiRetrieve() { LOGGER.debug("occiRetrieve() called on " + this); // TODO: Implement this callback or remove this method. } @@ -75,8 +69,7 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro * Called when this Monitoringproperty instance is completely updated. */ @Override - public void occiUpdate() - { + public void occiUpdate() { LOGGER.debug("occiUpdate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -87,8 +80,7 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro * Called when this Monitoringproperty instance will be deleted. */ @Override - public void occiDelete() - { + public void occiDelete() { LOGGER.debug("occiDelete() called on " + this); // TODO: Implement this callback or remove this method. } @@ -98,7 +90,4 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro // Monitoringproperty actions. // - - - -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/OcciresultproviderConnector.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/OcciresultproviderConnector.java index 6b2ec517c4dcf19d6198793da5c92c966274c6b1..41a4cd0f6c9aef914dd6bfc2eea0919a522d8a3a 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/OcciresultproviderConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/OcciresultproviderConnector.java @@ -1,32 +1,29 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Thu Jan 03 13:17:39 CET 2019 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: martpublisher - * - title: MartPublisher Mixin + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: martpublisher - title: + * MartPublisher Mixin */ -public class OcciresultproviderConnector extends monitoring.impl.OcciresultproviderImpl -{ +public class OcciresultproviderConnector extends monitoring.impl.OcciresultproviderImpl { /** * Initialize the logger. */ @@ -36,15 +33,10 @@ public class OcciresultproviderConnector extends monitoring.impl.Occiresultprovi /** * Constructs a martpublisher connector. */ - OcciresultproviderConnector() - { + OcciresultproviderConnector() { LOGGER.debug("Constructor called on " + this); // TODO: Implement this constructor. } // End of user code - - - - -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderConnector.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderConnector.java index 22a81506dc6989670bf248c62e26cad4464ae174..09d832d9ae5bb559505b78a3569c50c2c18ae49e 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderConnector.java @@ -1,80 +1,62 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Wed Dec 19 10:30:40 CET 2018 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; -import java.util.LinkedList; -import java.util.List; import java.util.NoSuchElementException; -import org.eclipse.cmf.occi.core.AttributeState; import org.eclipse.cmf.occi.core.Link; -import org.eclipse.cmf.occi.core.MixinBase; -import org.eclipse.cmf.occi.core.Resource; -import org.eclipse.cmf.occi.core.impl.OCCIFactoryImpl; -import org.modmacao.occi.platform.Component; import org.modmacao.occi.platform.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import monitoring.Monitorableproperty; -import monitoring.Occiresultprovider; import monitoring.Sensor; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: publisher - * - title: Publisher Resource + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: publisher - title: Publisher + * Resource */ -public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl -{ +public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl { /** * Initialize the logger. */ private static Logger LOGGER = LoggerFactory.getLogger(ResultproviderConnector.class); private Thread simulation; - //private Occiresultprovider occiResProv; - + // private Occiresultprovider occiResProv; // Start of user code Publisherconnector_constructor /** * Constructs a publisher connector. */ - ResultproviderConnector() - { + ResultproviderConnector() { LOGGER.debug("Constructor called on " + this); - - + } // End of user code // // OCCI CRUD callback operations. // - - - // Start of user code PublisherocciCreate /** * Called when this Publisher instance is completely created. */ @Override - public void occiCreate() - { + public void occiCreate() { LOGGER.debug("occiCreate() called on " + this); // TODO: Implement this callback or remove this method. @@ -86,12 +68,11 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl * Called when this Publisher instance must be retrieved. */ @Override - public void occiRetrieve() - { + public void occiRetrieve() { LOGGER.debug("occiRetrieve() called on " + this); - - if(this.getOcciComponentState().getValue() == Status.ACTIVE.getValue()) { - if(simulation == null) { + + if (this.getOcciComponentState().getValue() == Status.ACTIVE.getValue()) { + if (simulation == null) { ResultproviderSimulation sim = new ResultproviderSimulation(getMonProp(getSensor())); simulation = new Thread(sim); simulation.start(); @@ -106,8 +87,7 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl * Called when this Publisher instance is completely updated. */ @Override - public void occiUpdate() - { + public void occiUpdate() { LOGGER.debug("occiUpdate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -117,11 +97,11 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl /** * Called when this Publisher instance will be deleted. */ + @SuppressWarnings("deprecation") @Override - public void occiDelete() - { + public void occiDelete() { LOGGER.debug("occiDelete() called on " + this); - if(simulation!= null) { + if (simulation != null) { simulation.stop(); } // TODO: Implement this callback or remove this method. @@ -134,167 +114,155 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl // Start of user code Publisher_Kind_configure_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: configure - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: configure + * - title: */ @Override - public void configure() - { + public void configure() { LOGGER.debug("Action configure() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.DEPLOYED_VALUE: - this.setOcciComponentState(Status.INACTIVE); + this.setOcciComponentState(Status.INACTIVE); break; - + default: break; } // TODO: Implement how to configure this publisher. } + // End of user code // Start of user code Publisher_Kind_deploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: deploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: deploy - + * title: */ @Override - public void deploy() - { + public void deploy() { LOGGER.debug("Action deploy() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.UNDEPLOYED_VALUE: this.setOcciComponentState(Status.DEPLOYED); break; - + default: break; -} - + } + } // End of user code // Start of user code Publisher_Kind_undeploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: undeploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: undeploy + * - title: */ @SuppressWarnings("deprecation") @Override - public void undeploy() - { + public void undeploy() { LOGGER.debug("Action undeploy() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.ACTIVE_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); - if(simulation!= null) { + if (simulation != null) { simulation.stop(); } break; - case Status.INACTIVE_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; - case Status.DEPLOYED_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; - case Status.ERROR_VALUE: this.setOcciComponentState(Status.UNDEPLOYED); break; default: break; -} + } } + // End of user code // Start of user code Publisher_Kind_Stop_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: stop - * - title: Stop the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: stop - + * title: Stop the application. */ @SuppressWarnings("deprecation") @Override - public void stop() - { + public void stop() { LOGGER.debug("Action stop() called on " + this); - if(simulation!= null) { + if (simulation != null) { simulation.stop(); } setOcciComponentState(Status.INACTIVE); } + // End of user code // Start of user code Publisher_Kind_Start_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: start - * - title: Start the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: start - + * title: Start the application. */ @Override - public void start() - { + public void start() { LOGGER.debug("Action start() called on " + this); - switch(this.getOcciComponentState().getValue()) { + switch (this.getOcciComponentState().getValue()) { case Status.INACTIVE_VALUE: - this.setOcciComponentState(Status.ACTIVE); - if(simulation == null) { - ResultproviderSimulation sim = new ResultproviderSimulation(getMonProp(getSensor())); - simulation = new Thread(sim); - simulation.start(); - } + this.setOcciComponentState(Status.ACTIVE); + if (simulation == null) { + ResultproviderSimulation sim = new ResultproviderSimulation(getMonProp(getSensor())); + simulation = new Thread(sim); + simulation.start(); + } break; - case Status.UNDEPLOYED_VALUE: - this.setOcciComponentState(Status.ACTIVE); - if(simulation == null) { - ResultproviderSimulation sim = new ResultproviderSimulation(getMonProp(getSensor())); - simulation = new Thread(sim); - simulation.start(); - } - break; + this.setOcciComponentState(Status.ACTIVE); + if (simulation == null) { + ResultproviderSimulation sim = new ResultproviderSimulation(getMonProp(getSensor())); + simulation = new Thread(sim); + simulation.start(); + } + break; default: break; - - } + + } } - + // End of user code - - + private Sensor getSensor() { - for(Link link: this.getRlinks()) { - if(link.getSource() instanceof Sensor) { + for (Link link : this.getRlinks()) { + if (link.getSource() instanceof Sensor) { return ((Sensor) link.getSource()); } } throw new NoSuchElementException("No containing sensor found!"); } - + private Monitorableproperty getMonProp(Sensor sensor) { - for(Link link: sensor.getLinks()) { - if(link instanceof Monitorableproperty) { + for (Link link : sensor.getLinks()) { + if (link instanceof Monitorableproperty) { return ((Monitorableproperty) link); } } throw new NoSuchElementException("No monitorableproperty found in sensor!"); } - -} + +} diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderHelper.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderHelper.java index da357ff1726d313fdbc0c34777f2849aa1eef7eb..0f9ca6d5bf61fe55292e21b23888c57b637b0341 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderHelper.java +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderHelper.java @@ -1,3 +1,14 @@ +/** + * Copyright (c) 2018-2019 University of Goettingen + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> + */ + package de.ugoe.cs.rwm.mocci.connector; import java.io.IOException; @@ -7,43 +18,44 @@ import java.util.Properties; public final class ResultproviderHelper { Properties props; private final static String FILENAME = "resultprovider.properties"; - + public ResultproviderHelper() { loadProperties(); } - + /** * Getter method for providing the properties of this ResultProviderHelper. * Properties will be read from local file resultprovider.properties. + * * @return The properties */ public Properties getProperties() { - if (props == null) + if (props == null) { loadProperties(); - + } + return props; -} - + } + private void loadProperties() { props = new Properties(); - InputStream input = null; - - try { - input = this.getClass().getClassLoader().getResourceAsStream(FILENAME); - props.load(input); - - } catch (IOException ex) { - ex.printStackTrace(); - } finally{ - if(input!=null){ - try { - input.close(); - } catch (IOException e) { - e.printStackTrace(); + InputStream input = null; + + try { + input = this.getClass().getClassLoader().getResourceAsStream(FILENAME); + props.load(input); + + } catch (IOException ex) { + ex.printStackTrace(); + } finally { + if (input != null) { + try { + input.close(); + } catch (IOException e) { + e.printStackTrace(); + } } - } - } -} - - + } + } + } diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderSimulation.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderSimulation.java index a8f560a4096947ee2f090a5aa929e3de9f290d58..6f780b4b2b4689707ce275964a601394d478d6b7 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderSimulation.java +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderSimulation.java @@ -1,9 +1,19 @@ +/** + * Copyright (c) 2018-2019 University of Goettingen + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> + */ + package de.ugoe.cs.rwm.mocci.connector; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Random; import java.util.concurrent.ThreadLocalRandom; import org.eclipse.cmf.occi.core.AttributeState; @@ -13,52 +23,50 @@ import org.slf4j.LoggerFactory; import monitoring.Monitorableproperty; -public class ResultproviderSimulation implements Runnable{ +public class ResultproviderSimulation implements Runnable { private static Logger LOGGER = LoggerFactory.getLogger(ResultproviderSimulation.class); private Monitorableproperty monProp; private OCCIFactoryImpl factory = new OCCIFactoryImpl(); - private static Random random; private int interval; private List<String> results; - + public ResultproviderSimulation(Monitorableproperty monProp) { this.monProp = monProp; String property = getProperty(monProp.getMonitoringProperty()); List<String> items = new ArrayList<String>(Arrays.asList(property.split("\\s*,\\s*"))); - this.interval = Integer.parseInt(items.get(items.size()-1)); - String lastItem = items.get(items.size()-1); - items.remove(items.get(items.size()-1)); + this.interval = Integer.parseInt(items.get(items.size() - 1)); + items.remove(items.get(items.size() - 1)); this.results = items; - LOGGER.info("Creating Simulation for: " + monProp.getMonitoringProperty() + "; with values: " + results + "; and interval: " + interval); + LOGGER.info("Creating Simulation for: " + monProp.getMonitoringProperty() + "; with values: " + results + + "; and interval: " + interval); } - + @Override public void run() { - while(true) { + while (true) { try { Thread.sleep(interval); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + AttributeState monPropAttr = factory.createAttributeState(); monPropAttr.setName("monitoring.result"); int randomElementIndex = ThreadLocalRandom.current().nextInt(results.size()); String value = results.get(randomElementIndex); monPropAttr.setValue(value); monProp.setMonitoringResult(value); - LOGGER.info("MonProp: " + monProp.getMonitoringProperty() + ", set to: " + value + "(" +monProp.getId()+")" ); + LOGGER.info( + "MonProp: " + monProp.getMonitoringProperty() + ", set to: " + value + "(" + monProp.getId() + ")"); monProp.getAttributes().add(monPropAttr); } - + } - + private String getProperty(String monitoringProperty) { return new ResultproviderHelper().getProperties().getProperty(monitoringProperty); - + } } - - diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/SensorConnector.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/SensorConnector.java index 08b97c4d88dfd0110c98689bc859a4cb50bf6d1a..ecf7c84292286760b69b1edad2ebd15b933de7bf 100644 --- a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/SensorConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/SensorConnector.java @@ -1,44 +1,37 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Wed Dec 05 12:12:23 CET 2018 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; import java.util.LinkedList; import java.util.List; import org.eclipse.cmf.occi.core.Link; -import org.modmacao.cm.ConfigurationManagementTool; -import org.modmacao.cm.ansible.AnsibleCMTool; -import org.modmacao.core.connector.ApplicationConnector; import org.modmacao.occi.platform.Component; import org.modmacao.occi.platform.Componentlink; import org.modmacao.occi.platform.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: sensor - * - title: Sensor Component + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: sensor - title: Sensor + * Component */ -public class SensorConnector extends monitoring.impl.SensorImpl -{ - - +public class SensorConnector extends monitoring.impl.SensorImpl { + /** * Initialize the logger. */ @@ -48,8 +41,7 @@ public class SensorConnector extends monitoring.impl.SensorImpl /** * Constructs a sensor connector. */ - SensorConnector() - { + SensorConnector() { LOGGER.debug("Constructor called on " + this); // TODO: Implement this constructor. } @@ -57,14 +49,13 @@ public class SensorConnector extends monitoring.impl.SensorImpl // // OCCI CRUD callback operations. // - + // Start of user code SensorocciCreate /** * Called when this Sensor instance is completely created. */ @Override - public void occiCreate() - { + public void occiCreate() { LOGGER.debug("occiCreate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -75,8 +66,7 @@ public class SensorConnector extends monitoring.impl.SensorImpl * Called when this Sensor instance must be retrieved. */ @Override - public void occiRetrieve() - { + public void occiRetrieve() { LOGGER.debug("occiRetrieve() called on " + this); // TODO: Implement this callback or remove this method. } @@ -87,8 +77,7 @@ public class SensorConnector extends monitoring.impl.SensorImpl * Called when this Sensor instance is completely updated. */ @Override - public void occiUpdate() - { + public void occiUpdate() { LOGGER.debug("occiUpdate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -99,8 +88,7 @@ public class SensorConnector extends monitoring.impl.SensorImpl * Called when this Sensor instance will be deleted. */ @Override - public void occiDelete() - { + public void occiDelete() { LOGGER.debug("occiDelete() called on " + this); // TODO: Implement this callback or remove this method. } @@ -112,224 +100,206 @@ public class SensorConnector extends monitoring.impl.SensorImpl // Start of user code Sensor_Kind_deploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: deploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: deploy - + * title: */ @Override - public void deploy() - { + public void deploy() { LOGGER.debug("Action deploy() called on " + this); // Application State Machine. - switch(getOcciAppState().getValue()) { + switch (getOcciAppState().getValue()) { case Status.UNDEPLOYED_VALUE: LOGGER.debug("Fire transition(state=undeployed, action=\"deploy\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.deploy(); } - - setOcciAppState(Status.DEPLOYED); -} + setOcciAppState(Status.DEPLOYED); + + break; + + default: + break; + } } + // End of user code // Start of user code Sensor_Kind_undeploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: undeploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: undeploy + * - title: */ @Override - public void undeploy() - { + public void undeploy() { LOGGER.debug("Action undeploy() called on " + this); // Application State Machine. - switch(getOcciAppState().getValue()) { + switch (getOcciAppState().getValue()) { case Status.ACTIVE_VALUE: LOGGER.debug("Fire transition(state=active, action=\"undeploy\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.stop(); } this.stop(); - - for (Component component: this.getConnectedComponents()) { + + for (Component component : this.getConnectedComponents()) { component.undeploy(); } - setOcciAppState(Status.UNDEPLOYED); + setOcciAppState(Status.UNDEPLOYED); break; case Status.INACTIVE_VALUE: LOGGER.debug("Fire transition(state=inactive, action=\"undeploy\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.undeploy(); } - - setOcciAppState(Status.UNDEPLOYED); + + setOcciAppState(Status.UNDEPLOYED); break; case Status.DEPLOYED_VALUE: LOGGER.debug("Fire transition(state=deployed, action=\"undeploy\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.undeploy(); } - - setOcciAppState(Status.UNDEPLOYED); + + setOcciAppState(Status.UNDEPLOYED); break; case Status.ERROR_VALUE: LOGGER.debug("Fire transition(state=error, action=\"undeploy\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.undeploy(); } - - setOcciAppState(Status.UNDEPLOYED); + + setOcciAppState(Status.UNDEPLOYED); break; default: break; -} + } } + // End of user code // Start of user code Sensor_Kind_Stop_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: stop - * - title: Stop the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: stop - + * title: Stop the application. */ @Override - public void stop() - { + public void stop() { LOGGER.debug("Action stop() called on " + this); // Application State Machine. - switch(getOcciAppState().getValue()) { + switch (getOcciAppState().getValue()) { case Status.ACTIVE_VALUE: LOGGER.debug("Fire transition(state=active, action=\"stop\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.stop(); } - - setOcciAppState(Status.INACTIVE); + + setOcciAppState(Status.INACTIVE); break; default: break; -} + } // TODO: Implement how to stop this sensor. } + // End of user code // Start of user code Sensor_Kind_configure_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: configure - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: configure + * - title: */ @Override - public void configure() - { - int status = -1; + public void configure() { LOGGER.debug("Action configure() called on " + this); // Application State Machine. - switch(getOcciAppState().getValue()) { + switch (getOcciAppState().getValue()) { case Status.DEPLOYED_VALUE: LOGGER.debug("Fire transition(state=deployed, action=\"configure\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.configure(); } - - - setOcciAppState(Status.INACTIVE); + + setOcciAppState(Status.INACTIVE); break; default: break; -} + } } + // End of user code // Start of user code Sensor_Kind_Start_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: start - * - title: Start the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: start - + * title: Start the application. */ @Override - public void start() - { - int status = -1; + public void start() { LOGGER.debug("Action start() called on " + this); - + // Application State Machine. - switch(getOcciAppState().getValue()) { + switch (getOcciAppState().getValue()) { case Status.INACTIVE_VALUE: LOGGER.debug("Fire transition(state=inactive, action=\"start\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.start(); } - - setOcciAppState(Status.ACTIVE); - break; + setOcciAppState(Status.ACTIVE); + break; case Status.UNDEPLOYED_VALUE: LOGGER.debug("Fire transition(state=undeployed, action=\"start\")..."); // First deploy components - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.deploy(); } this.deploy(); - + // then configure them - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.configure(); } this.configure(); - + // then start them - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.start(); } - setOcciAppState(Status.ACTIVE); + setOcciAppState(Status.ACTIVE); break; default: break; -} + } } + // End of user code private List<Component> getConnectedComponents() { LinkedList<Component> connectedComponents = new LinkedList<Component>(); - for (Link link: this.getLinks()) { + for (Link link : this.getLinks()) { if (link instanceof Componentlink) { connectedComponents.add((Component) link.getTarget()); } } return connectedComponents; - - } - - private boolean assertCompsStatusEquals(List<Component> components, Status status) { - for (Component component: components) { - if (component.getOcciComponentState().getValue() != status.getValue()) { - LOGGER.debug("Missmatching state of component " + component.getTitle() + " detected. " - + "Expected " + status.getName() + " but was " - + component.getOcciComponentState().getName() + "."); - return false; - } - } - return true; -} + } -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/package-info.java b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..0120906f531862b29c79cd6120f36c9f50c42ca4 --- /dev/null +++ b/de.ugoe.cs.rwm.mocci.connector.dummy/src-gen/de/ugoe/cs/rwm/mocci/connector/package-info.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2019 University of Goettingen. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> + *******************************************************************************/ +/** + * + */ +/** + * Main package for mocci connector dummy. + * + * @author erbel + * + */ +package de.ugoe.cs.rwm.mocci.connector; \ No newline at end of file diff --git a/de.ugoe.cs.rwm.mocci.connector/build.gradle b/de.ugoe.cs.rwm.mocci.connector/build.gradle index 8ada62e6640b67e4e4b83e334cc87f3767556f6d..6647d9b393dcae4ec6c5ea803d6feed0859f6f06 100644 --- a/de.ugoe.cs.rwm.mocci.connector/build.gradle +++ b/de.ugoe.cs.rwm.mocci.connector/build.gradle @@ -1,34 +1,6 @@ -// Apply the java-library plugin to add support for Java Library -apply plugin : 'eclipse' -apply plugin: 'java' -apply plugin: 'maven' - - -// In this section you declare where to find the dependencies of your project -repositories { - // Use jcenter for resolving your dependencies. - // You can declare any Maven/Ivy/file repository here. - //mavenLocal() - mavenCentral() - - maven { - url "https://nexus.informatik.uni-goettingen.de/content/repositories/thirdparty/" - } - maven { - url "https://nexus.informatik.uni-goettingen.de/content/repositories/rwm/" - } -} - dependencies { - -//Require-Bundle: org.eclipse.core.runtime, -// org.eclipse.emf.ecore;visibility:=reexport, - - //org.eclipse.ocl.examples.codegen;visibility:=reexport, - //Nexus compile group: 'org.eclipse.ocl', name: 'pivot', version: '1.3.0' - //compile group: 'de.ugoe.cs.rwm.wocci', name: 'model', version: '1.0.0' //occiware compile group: 'org.eclipse.cmf.occi', name: 'core', version: '1.0.0' compile group: 'org.modmacao.occi', name: 'platform', version: '1.0.0' @@ -37,14 +9,11 @@ dependencies { compile group: 'org.modmacao.core', name: 'connector', version : '1.0.0' compile group: 'commons-io', name: 'commons-io', version: '2.6' - - //maven compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' - compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore', version: '2.15.0' + compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore', version: '2.15.0' compile group: 'org.eclipse.emf', name: 'org.eclipse.emf.ecore.xmi', version: '2.15.0' - testCompile group: 'junit', name: 'junit', version: '4.12' } diff --git a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ComponentManager.java b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ComponentManager.java index 7ec0b68e73224d67d1b626737e67aa55fea4c195..d30dd681738dcbb72fba75442a1ef264d66c969f 100644 --- a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ComponentManager.java +++ b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ComponentManager.java @@ -15,211 +15,206 @@ import modmacao.Installationdependency; public class ComponentManager { - private ConfigurationManagementTool cmtool = new AnsibleCMTool(); private Component comp; - + public ComponentManager(Component comp) { this.comp = comp; } - public void undeploy() { - switch(comp.getOcciComponentState().getValue()) { - - case Status.ACTIVE_VALUE: - - comp.stop(); - cmtool.undeploy(comp); - comp.setOcciComponentState(Status.UNDEPLOYED); - break; - + switch (comp.getOcciComponentState().getValue()) { - case Status.INACTIVE_VALUE: - cmtool.undeploy(comp); - comp.setOcciComponentState(Status.UNDEPLOYED); - break; + case Status.ACTIVE_VALUE: + comp.stop(); + cmtool.undeploy(comp); + comp.setOcciComponentState(Status.UNDEPLOYED); + break; - case Status.DEPLOYED_VALUE: - cmtool.undeploy(comp); - comp.setOcciComponentState(Status.UNDEPLOYED); - break; + case Status.INACTIVE_VALUE: + cmtool.undeploy(comp); + comp.setOcciComponentState(Status.UNDEPLOYED); + break; + case Status.DEPLOYED_VALUE: + cmtool.undeploy(comp); + comp.setOcciComponentState(Status.UNDEPLOYED); + break; - case Status.ERROR_VALUE: - cmtool.undeploy(comp); - comp.setOcciComponentState(Status.UNDEPLOYED); - break; + case Status.ERROR_VALUE: + cmtool.undeploy(comp); + comp.setOcciComponentState(Status.UNDEPLOYED); + break; - default: - break; + default: + break; } } + // End of user code // Start of user code Publisher_Kind_deploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: deploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: deploy - + * title: */ - public void deploy() - { + public void deploy() { int status = -1; // Component State Machine. - switch(comp.getOcciComponentState().getValue()) { + switch (comp.getOcciComponentState().getValue()) { case Status.UNDEPLOYED_VALUE: - for (Component component: getInstallDependendComps()) { + for (Component component : getInstallDependendComps()) { component.deploy(); } status = cmtool.deploy(comp); - - if (status == 0 && assertCompsStatusEquals(getInstallDependendComps(), Status.DEPLOYED)) + + if (status == 0 && assertCompsStatusEquals(getInstallDependendComps(), Status.DEPLOYED)) { comp.setOcciComponentState(Status.DEPLOYED); - else + } else { comp.setOcciComponentState(Status.ERROR); + } break; default: break; -} + } } + // End of user code // Start of user code Publisher_Kind_configure_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: configure - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: configure + * - title: */ - public void configure() - { + public void configure() { int status = -1; // Component State Machine. - switch(comp.getOcciComponentState().getValue()) { + switch (comp.getOcciComponentState().getValue()) { case Status.DEPLOYED_VALUE: - for (Component component: getInstallDependendComps()) { + for (Component component : getInstallDependendComps()) { component.configure(); } status = cmtool.configure(comp); - - if (status == 0 && assertCompsStatusEquals(getInstallDependendComps(), Status.INACTIVE)) + + if (status == 0 && assertCompsStatusEquals(getInstallDependendComps(), Status.INACTIVE)) { comp.setOcciComponentState(Status.INACTIVE); - else + } else { comp.setOcciComponentState(Status.ERROR); + } break; default: break; -} + } } + // End of user code // Start of user code Publisher_Kind_Start_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: start - * - title: Start the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: start - + * title: Start the application. */ - public void start() - { + public void start() { int status = -1; // Component State Machine. - switch(comp.getOcciComponentState().getValue()) { + switch (comp.getOcciComponentState().getValue()) { case Status.INACTIVE_VALUE: - for (Component component: getExecutionDependendComps()) { + for (Component component : getExecutionDependendComps()) { component.start(); } - + status = cmtool.start(comp); - - if (status == 0 && assertCompsStatusEquals(getExecutionDependendComps(), Status.ACTIVE)) + + if (status == 0 && assertCompsStatusEquals(getExecutionDependendComps(), Status.ACTIVE)) { comp.setOcciComponentState(Status.ACTIVE); - else + } else { comp.setOcciComponentState(Status.ERROR); - - break; + } + break; case Status.UNDEPLOYED_VALUE: - for (Component component: getInstallDependendComps()) { + for (Component component : getInstallDependendComps()) { component.deploy(); } comp.deploy(); - - for (Component component: getInstallDependendComps()) { + + for (Component component : getInstallDependendComps()) { component.configure(); } comp.configure(); - - for (Component component: getExecutionDependendComps()) { + + for (Component component : getExecutionDependendComps()) { component.start(); } - + status = cmtool.start(comp); - - if (status == 0 && assertCompsStatusEquals(getExecutionDependendComps(), Status.ACTIVE)) + + if (status == 0 && assertCompsStatusEquals(getExecutionDependendComps(), Status.ACTIVE)) { comp.setOcciComponentState(Status.ACTIVE); - else + } else { comp.setOcciComponentState(Status.ERROR); + } + + break; default: break; -} + } } + // End of user code // Start of user code Publisher_Kind_Stop_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: stop - * - title: Stop the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: stop - + * title: Stop the application. */ - public void stop() - { - int status = -1; + public void stop() { // Component State Machine. - switch(comp.getOcciComponentState().getValue()) { + switch (comp.getOcciComponentState().getValue()) { case Status.ACTIVE_VALUE: - - status = cmtool.stop(comp); - + + cmtool.stop(comp); + comp.setOcciComponentState(Status.INACTIVE); - + break; default: break; -} + } } // End of user code - - private List<Component> getInstallDependendComps(){ + + private List<Component> getInstallDependendComps() { LinkedList<Component> dependendComponents = new LinkedList<Component>(); - for (Link link: comp.getLinks()) { - for (MixinBase mixin: link.getParts()) { + for (Link link : comp.getLinks()) { + for (MixinBase mixin : link.getParts()) { if (mixin instanceof Installationdependency) { dependendComponents.add((Component) link.getTarget()); break; } } } - return dependendComponents; + return dependendComponents; } - - private List<Component> getExecutionDependendComps(){ + + private List<Component> getExecutionDependendComps() { LinkedList<Component> dependendComponents = new LinkedList<Component>(); - for (Link link: comp.getLinks()) { - for (MixinBase mixin: link.getParts()) { + for (Link link : comp.getLinks()) { + for (MixinBase mixin : link.getParts()) { if (mixin instanceof Executiondependency) { dependendComponents.add((Component) link.getTarget()); break; @@ -228,14 +223,14 @@ public class ComponentManager { } return dependendComponents; } - + private boolean assertCompsStatusEquals(List<Component> components, Status status) { - for (Component component: components) { + for (Component component : components) { if (component.getOcciComponentState().getValue() != status.getValue()) { return false; } - } + } return true; -} + } -} \ No newline at end of file +} \ No newline at end of file diff --git a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ConnectorFactory.java b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ConnectorFactory.java index 812be75c8b67141a89b3d925e8ec2054538b7882..1a111a43841d3fdb10ede99df08de763d457d93c 100644 --- a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ConnectorFactory.java +++ b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ConnectorFactory.java @@ -1,31 +1,29 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Wed Jan 02 16:14:48 CET 2019 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; /** - * Connector EFactory for the OCCI extension: - * - name: monitoring - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# + * Connector EFactory for the OCCI extension: - name: monitoring - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# */ -public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl -{ +public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl { /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: sensor - * - title: Sensor Component + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: sensor - title: Sensor + * Component */ @Override public monitoring.Sensor createSensor() { @@ -33,10 +31,9 @@ public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl } /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: datagatherer - * - title: DataGatherer Resource + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: datagatherer - title: + * DataGatherer Resource */ @Override public monitoring.Datagatherer createDatagatherer() { @@ -44,10 +41,9 @@ public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl } /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: processor - * - title: Processor Resource + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: processor - title: Processor + * Resource */ @Override public monitoring.Dataprocessor createDataprocessor() { @@ -55,10 +51,9 @@ public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl } /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: publisher - * - title: Publisher Resource + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: publisher - title: Publisher + * Resource */ @Override public monitoring.Resultprovider createResultprovider() { @@ -66,10 +61,9 @@ public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl } /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: monitoringproperty - * - title: MonitoringProperty Component + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: monitoringproperty - title: + * MonitoringProperty Component */ @Override public monitoring.Monitorableproperty createMonitorableproperty() { @@ -77,10 +71,9 @@ public class ConnectorFactory extends monitoring.impl.MonitoringFactoryImpl } /** - * EFactory method for OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: martpublisher - * - title: MartPublisher Mixin + * EFactory method for OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: martpublisher - title: + * MartPublisher Mixin */ @Override public monitoring.Occiresultprovider createOcciresultprovider() { diff --git a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/DatagathererConnector.java b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/DatagathererConnector.java index f21b2b49377dfae9f4404aad31d0d81ed34a9b71..f4248616f9f308eda19b3dcd20ffaa031ae16f13 100644 --- a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/DatagathererConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/DatagathererConnector.java @@ -1,43 +1,40 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Wed Dec 19 11:10:50 CET 2018 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: datagatherer - * - title: DataGatherer Resource + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: datagatherer - title: + * DataGatherer Resource */ -public class DatagathererConnector extends monitoring.impl.DatagathererImpl -{ +public class DatagathererConnector extends monitoring.impl.DatagathererImpl { /** * Initialize the logger. */ private static Logger LOGGER = LoggerFactory.getLogger(DatagathererConnector.class); private ComponentManager compMan; + // Start of user code Datagathererconnector_constructor /** * Constructs a datagatherer connector. */ - DatagathererConnector() - { + DatagathererConnector() { LOGGER.debug("Constructor called on " + this); this.compMan = new ComponentManager(this); // TODO: Implement this constructor. @@ -46,14 +43,13 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl // // OCCI CRUD callback operations. // - + // Start of user code DatagathererocciCreate /** * Called when this Datagatherer instance is completely created. */ @Override - public void occiCreate() - { + public void occiCreate() { LOGGER.debug("occiCreate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -64,8 +60,7 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl * Called when this Datagatherer instance must be retrieved. */ @Override - public void occiRetrieve() - { + public void occiRetrieve() { LOGGER.debug("occiRetrieve() called on " + this); // TODO: Implement this callback or remove this method. } @@ -76,8 +71,7 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl * Called when this Datagatherer instance is completely updated. */ @Override - public void occiUpdate() - { + public void occiUpdate() { LOGGER.debug("occiUpdate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -88,8 +82,7 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl * Called when this Datagatherer instance will be deleted. */ @Override - public void occiDelete() - { + public void occiDelete() { LOGGER.debug("occiDelete() called on " + this); this.stop(); this.undeploy(); @@ -102,80 +95,72 @@ public class DatagathererConnector extends monitoring.impl.DatagathererImpl // Start of user code Datagatherer_Kind_deploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: deploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: deploy - + * title: */ @Override - public void deploy() - { + public void deploy() { LOGGER.debug("Action deploy() called on " + this); compMan.deploy(); // TODO: Implement how to deploy this datagatherer. } + // End of user code // Start of user code Datagatherer_Kind_Stop_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: stop - * - title: Stop the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: stop - + * title: Stop the application. */ @Override - public void stop() - { + public void stop() { LOGGER.debug("Action stop() called on " + this); compMan.stop(); // TODO: Implement how to stop this datagatherer. } + // End of user code // Start of user code Datagatherer_Kind_Start_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: start - * - title: Start the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: start - + * title: Start the application. */ @Override - public void start() - { + public void start() { LOGGER.debug("Action start() called on " + this); compMan.start(); // TODO: Implement how to start this datagatherer. } + // End of user code // Start of user code Datagatherer_Kind_configure_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: configure - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: configure + * - title: */ @Override - public void configure() - { + public void configure() { LOGGER.debug("Action configure() called on " + this); compMan.configure(); // TODO: Implement how to configure this datagatherer. } + // End of user code // Start of user code Datagatherer_Kind_undeploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: undeploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: undeploy + * - title: */ @Override - public void undeploy() - { + public void undeploy() { LOGGER.debug("Action undeploy() called on " + this); compMan.undeploy(); // TODO: Implement how to undeploy this datagatherer. } // End of user code - - -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/DataprocessorConnector.java b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/DataprocessorConnector.java index e219e5ca4d9a3c1b9a9dd0a9e34cda90bf358509..af7b637173e37bab6fad586987e93e49c9b6f212 100644 --- a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/DataprocessorConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/DataprocessorConnector.java @@ -1,43 +1,40 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Wed Dec 19 11:10:50 CET 2018 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: processor - * - title: Processor Resource + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: processor - title: Processor + * Resource */ -public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl -{ +public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl { /** * Initialize the logger. */ private static Logger LOGGER = LoggerFactory.getLogger(DataprocessorConnector.class); private ComponentManager compMan; + // Start of user code Processorconnector_constructor /** * Constructs a processor connector. */ - DataprocessorConnector() - { + DataprocessorConnector() { LOGGER.debug("Constructor called on " + this); this.compMan = new ComponentManager(this); // TODO: Implement this constructor. @@ -46,14 +43,13 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl // // OCCI CRUD callback operations. // - + // Start of user code ProcessorocciCreate /** * Called when this Processor instance is completely created. */ @Override - public void occiCreate() - { + public void occiCreate() { LOGGER.debug("occiCreate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -64,8 +60,7 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl * Called when this Processor instance must be retrieved. */ @Override - public void occiRetrieve() - { + public void occiRetrieve() { LOGGER.debug("occiRetrieve() called on " + this); // TODO: Implement this callback or remove this method. } @@ -76,8 +71,7 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl * Called when this Processor instance is completely updated. */ @Override - public void occiUpdate() - { + public void occiUpdate() { LOGGER.debug("occiUpdate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -88,8 +82,7 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl * Called when this Processor instance will be deleted. */ @Override - public void occiDelete() - { + public void occiDelete() { LOGGER.debug("occiDelete() called on " + this); this.stop(); this.undeploy(); @@ -102,81 +95,73 @@ public class DataprocessorConnector extends monitoring.impl.DataprocessorImpl // Start of user code Processor_Kind_deploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: deploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: deploy - + * title: */ @Override - public void deploy() - { + public void deploy() { LOGGER.debug("Action deploy() called on " + this); compMan.deploy(); // TODO: Implement how to deploy this processor. } + // End of user code // Start of user code Processor_Kind_Stop_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: stop - * - title: Stop the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: stop - + * title: Stop the application. */ @Override - public void stop() - { + public void stop() { LOGGER.debug("Action stop() called on " + this); compMan.stop(); // TODO: Implement how to stop this processor. } + // End of user code // Start of user code Processor_Kind_Start_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: start - * - title: Start the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: start - + * title: Start the application. */ @Override - public void start() - { + public void start() { LOGGER.debug("Action start() called on " + this); compMan.start(); // TODO: Implement how to start this processor. } + // End of user code // Start of user code Processor_Kind_configure_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: configure - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: configure + * - title: */ @Override - public void configure() - { + public void configure() { LOGGER.debug("Action configure() called on " + this); compMan.configure(); // TODO: Implement how to configure this processor. } + // End of user code // Start of user code Processor_Kind_undeploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: undeploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: undeploy + * - title: */ @Override - public void undeploy() - { + public void undeploy() { LOGGER.debug("Action undeploy() called on " + this); compMan.undeploy(); // TODO: Implement how to undeploy this processor. } // End of user code - - -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/MonitorablepropertyConnector.java b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/MonitorablepropertyConnector.java index bb67a61a95584536e0dff979cf62b827d3878faf..05eb4392b9437c4d15782c817167de39514ca040 100644 --- a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/MonitorablepropertyConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/MonitorablepropertyConnector.java @@ -1,32 +1,29 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Wed Jan 02 16:14:48 CET 2019 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: monitoringproperty - * - title: MonitoringProperty Component + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: monitoringproperty - title: + * MonitoringProperty Component */ -public class MonitorablepropertyConnector extends monitoring.impl.MonitorablepropertyImpl -{ +public class MonitorablepropertyConnector extends monitoring.impl.MonitorablepropertyImpl { /** * Initialize the logger. */ @@ -36,8 +33,7 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro /** * Constructs a monitoringproperty connector. */ - MonitorablepropertyConnector() - { + MonitorablepropertyConnector() { LOGGER.debug("Constructor called on " + this); // TODO: Implement this constructor. } @@ -45,14 +41,13 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro // // OCCI CRUD callback operations. // - + // Start of user code MonitoringpropertyocciCreate /** * Called when this Monitoringproperty instance is completely created. */ @Override - public void occiCreate() - { + public void occiCreate() { LOGGER.debug("occiCreate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -63,8 +58,7 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro * Called when this Monitoringproperty instance must be retrieved. */ @Override - public void occiRetrieve() - { + public void occiRetrieve() { LOGGER.debug("occiRetrieve() called on " + this); // TODO: Implement this callback or remove this method. } @@ -75,8 +69,7 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro * Called when this Monitoringproperty instance is completely updated. */ @Override - public void occiUpdate() - { + public void occiUpdate() { LOGGER.debug("occiUpdate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -87,8 +80,7 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro * Called when this Monitoringproperty instance will be deleted. */ @Override - public void occiDelete() - { + public void occiDelete() { LOGGER.debug("occiDelete() called on " + this); // TODO: Implement this callback or remove this method. } @@ -98,7 +90,4 @@ public class MonitorablepropertyConnector extends monitoring.impl.Monitorablepro // Monitoringproperty actions. // - - - -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/OcciresultproviderConnector.java b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/OcciresultproviderConnector.java index 7bcf4241f23ce5796f15b1214cb4dfb9b75ac196..be84868cad85b8079612a0a2dadbc7fbb5e76bec 100644 --- a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/OcciresultproviderConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/OcciresultproviderConnector.java @@ -1,32 +1,29 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Wed Jan 02 16:14:48 CET 2019 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: martpublisher - * - title: MartPublisher Mixin + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: martpublisher - title: + * MartPublisher Mixin */ -public class OcciresultproviderConnector extends monitoring.impl.OcciresultproviderImpl -{ +public class OcciresultproviderConnector extends monitoring.impl.OcciresultproviderImpl { /** * Initialize the logger. */ @@ -36,15 +33,10 @@ public class OcciresultproviderConnector extends monitoring.impl.Occiresultprovi /** * Constructs a martpublisher connector. */ - OcciresultproviderConnector() - { + OcciresultproviderConnector() { LOGGER.debug("Constructor called on " + this); // TODO: Implement this constructor. } // End of user code - - - - -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderConnector.java b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderConnector.java index 4b5daa4297d905cac4f03cad7d185a74fb0c2fba..45a6b95c65b9eae6db80adab2d005c5aa2fe7076 100644 --- a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/ResultproviderConnector.java @@ -1,17 +1,18 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Wed Dec 19 11:10:50 CET 2018 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; import java.util.LinkedList; @@ -19,10 +20,8 @@ import java.util.List; import java.util.NoSuchElementException; import org.eclipse.cmf.occi.core.AttributeState; -import org.eclipse.cmf.occi.core.Configuration; import org.eclipse.cmf.occi.core.Link; import org.eclipse.cmf.occi.core.MixinBase; -import org.eclipse.cmf.occi.core.OCCIFactory; import org.eclipse.cmf.occi.core.Resource; import org.eclipse.cmf.occi.core.impl.OCCIFactoryImpl; import org.slf4j.Logger; @@ -31,18 +30,13 @@ import org.slf4j.LoggerFactory; import monitoring.Monitorableproperty; import monitoring.Occiresultprovider; import monitoring.Sensor; -import monitoring.impl.MonitoringFactoryImpl; - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: publisher - * - title: Publisher Resource + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: publisher - title: Publisher + * Resource */ -public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl -{ +public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl { /** * Initialize the logger. */ @@ -53,31 +47,28 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl private Monitorableproperty monProp; private Resource monObject; private List<AttributeState> workaround = new LinkedList<AttributeState>(); - + // Start of user code Publisherconnector_constructor /** * Constructs a publisher connector. */ - ResultproviderConnector() - { + ResultproviderConnector() { LOGGER.debug("Constructor called on " + this); this.compMan = new ComponentManager(this); } - // End of user code // // OCCI CRUD callback operations. // - + // Start of user code PublisherocciCreate /** * Called when this Publisher instance is completely created. */ @Override - public void occiCreate() - { + public void occiCreate() { LOGGER.debug("occiCreate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -88,8 +79,7 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl * Called when this Publisher instance must be retrieved. */ @Override - public void occiRetrieve() - { + public void occiRetrieve() { LOGGER.debug("occiRetrieve() called on " + this); // TODO: Implement this callback or remove this method. } @@ -100,8 +90,7 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl * Called when this Publisher instance is completely updated. */ @Override - public void occiUpdate() - { + public void occiUpdate() { LOGGER.debug("occiUpdate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -112,8 +101,7 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl * Called when this Publisher instance will be deleted. */ @Override - public void occiDelete() - { + public void occiDelete() { LOGGER.debug("occiDelete() called on " + this); // TODO: Implement this callback or remove this method. this.stop(); @@ -127,44 +115,40 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl // Start of user code Publisher_Kind_deploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: deploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: deploy - + * title: */ @Override - public void deploy() - { + public void deploy() { LOGGER.debug("Action deploy() called on " + this); compMan.deploy(); // TODO: Implement how to deploy this publisher. } + // End of user code // Start of user code Publisher_Kind_Stop_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: stop - * - title: Stop the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: stop - + * title: Stop the application. */ @Override - public void stop() - { + public void stop() { LOGGER.debug("Action stop() called on " + this); compMan.stop(); // TODO: Implement how to stop this publisher. } + // End of user code // Start of user code Publisher_Kind_Start_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: start - * - title: Start the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: start - + * title: Start the application. */ @Override - public void start() - { + public void start() { setRuntimeInformation(); System.out.println(this.attributes); LOGGER.debug("Action start() called on " + this); @@ -172,43 +156,39 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl removeRuntimeInformation(); System.out.println(this.attributes); } - - + // End of user code // Start of user code Publisher_Kind_configure_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: configure - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: configure + * - title: */ @Override - public void configure() - { + public void configure() { LOGGER.debug("Action configure() called on " + this); compMan.configure(); // TODO: Implement how to configure this publisher. } + // End of user code // Start of user code Publisher_Kind_undeploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: undeploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: undeploy + * - title: */ @Override - public void undeploy() - { + public void undeploy() { LOGGER.debug("Action undeploy() called on " + this); compMan.undeploy(); // TODO: Implement how to undeploy this publisher. } // End of user code - + private MixinBase getMartMixin() { - for(MixinBase mixinBase: this.getParts()) { - if(mixinBase instanceof Occiresultprovider) { + for (MixinBase mixinBase : this.getParts()) { + if (mixinBase instanceof Occiresultprovider) { LOGGER.info("MartPublisher Mixin found for Publisher:" + this.title); return mixinBase; } @@ -218,14 +198,14 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl private List<Monitorableproperty> getMonitoringProperties(Sensor sens) { LinkedList<Monitorableproperty> monProps = new LinkedList<Monitorableproperty>(); - for(Link link: sens.getLinks()) { - if(link instanceof Monitorableproperty) { + for (Link link : sens.getLinks()) { + if (link instanceof Monitorableproperty) { monProps.add((Monitorableproperty) link); } } return monProps; } - + private void setRuntimeInformation() { sensor = getSensor(); AttributeState sensorAttr = factory.createAttributeState(); @@ -234,7 +214,7 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl System.out.println("Sensor: " + sensor); this.attributes.add(sensorAttr); workaround.add(sensorAttr); - + monProp = getMonProp(sensor); AttributeState monPropAttr = factory.createAttributeState(); monPropAttr.setName("monitorable.property"); @@ -242,13 +222,13 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl System.out.println("MonProp: " + monProp); this.attributes.add(monPropAttr); workaround.add(monPropAttr); - + AttributeState monPropNameAttr = factory.createAttributeState(); monPropNameAttr.setName("monitorable.property.property"); monPropNameAttr.setValue(monProp.getMonitoringProperty()); this.attributes.add(monPropNameAttr); workaround.add(monPropNameAttr); - + monObject = monProp.getTarget(); AttributeState monObjectAttr = factory.createAttributeState(); monObjectAttr.setName("monitorable.property.target"); @@ -256,50 +236,48 @@ public class ResultproviderConnector extends monitoring.impl.ResultproviderImpl this.attributes.add(monObjectAttr); workaround.add(monObjectAttr); } - + private Sensor getSensor() { - for(Link link: this.getRlinks()) { - if(link.getSource() instanceof Sensor) { + for (Link link : this.getRlinks()) { + if (link.getSource() instanceof Sensor) { return ((Sensor) link.getSource()); } } throw new NoSuchElementException("No containing sensor found!"); } - + private Monitorableproperty getMonProp(Sensor sensor) { - for(Link link: sensor.getLinks()) { - if(link instanceof Monitorableproperty) { + for (Link link : sensor.getLinks()) { + if (link instanceof Monitorableproperty) { return ((Monitorableproperty) link); } } throw new NoSuchElementException("No monitorableproperty found in sensor!"); } - + private void removeRuntimeInformation() { - for(AttributeState work: workaround) { + for (AttributeState work : workaround) { this.attributes.remove(work); } - - } + } private String getContainingSensorLocation() { - for(Link link: this.getRlinks()) { - if(link.getSource() instanceof Sensor) { + for (Link link : this.getRlinks()) { + if (link.getSource() instanceof Sensor) { return link.getSource().getLocation(); } } return "No containing sensor found"; } - - + private Sensor getContainingSensor() { - for(Link link: this.getRlinks()) { - if(link.getSource() instanceof Sensor) { + for (Link link : this.getRlinks()) { + if (link.getSource() instanceof Sensor) { return (Sensor) link.getSource(); } } LOGGER.info("No containing Sensor found"); throw new NoSuchElementException(); } -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/SensorConnector.java b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/SensorConnector.java index 77bd20967655652e8cd018460819736f06748685..95166612f151854e3ac5e4f0f562f9f22ddb59e0 100644 --- a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/SensorConnector.java +++ b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/SensorConnector.java @@ -1,17 +1,18 @@ /** * Copyright (c) 2016-2017 Inria - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Philippe Merle <philippe.merle@inria.fr> * - Faiez Zalila <faiez.zalila@inria.fr> * * Generated at Mon Dec 17 14:48:34 CET 2018 from platform:/resource/monitoring/model/monitoring.occie by org.eclipse.cmf.occi.core.gen.connector */ + package de.ugoe.cs.rwm.mocci.connector; import java.util.LinkedList; @@ -26,17 +27,12 @@ import org.modmacao.occi.platform.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - - /** - * Connector implementation for the OCCI kind: - * - scheme: http://schemas.ugoe.cs.rwm/monitoring# - * - term: sensor - * - title: Sensor Component + * Connector implementation for the OCCI kind: - scheme: + * http://schemas.ugoe.cs.rwm/monitoring# - term: sensor - title: Sensor + * Component */ -public class SensorConnector extends monitoring.impl.SensorImpl -{ +public class SensorConnector extends monitoring.impl.SensorImpl { private ConfigurationManagementTool cmtool = new AnsibleCMTool(); /** * Initialize the logger. @@ -47,8 +43,7 @@ public class SensorConnector extends monitoring.impl.SensorImpl /** * Constructs a sensor connector. */ - SensorConnector() - { + SensorConnector() { LOGGER.debug("Constructor called on " + this); // TODO: Implement this constructor. } @@ -56,14 +51,13 @@ public class SensorConnector extends monitoring.impl.SensorImpl // // OCCI CRUD callback operations. // - + // Start of user code SensorocciCreate /** * Called when this Sensor instance is completely created. */ @Override - public void occiCreate() - { + public void occiCreate() { LOGGER.debug("occiCreate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -74,8 +68,7 @@ public class SensorConnector extends monitoring.impl.SensorImpl * Called when this Sensor instance must be retrieved. */ @Override - public void occiRetrieve() - { + public void occiRetrieve() { LOGGER.debug("occiRetrieve() called on " + this); // TODO: Implement this callback or remove this method. } @@ -86,8 +79,7 @@ public class SensorConnector extends monitoring.impl.SensorImpl * Called when this Sensor instance is completely updated. */ @Override - public void occiUpdate() - { + public void occiUpdate() { LOGGER.debug("occiUpdate() called on " + this); // TODO: Implement this callback or remove this method. } @@ -98,8 +90,7 @@ public class SensorConnector extends monitoring.impl.SensorImpl * Called when this Sensor instance will be deleted. */ @Override - public void occiDelete() - { + public void occiDelete() { LOGGER.debug("occiDelete() called on " + this); this.stop(); this.undeploy(); @@ -113,262 +104,260 @@ public class SensorConnector extends monitoring.impl.SensorImpl // Start of user code Sensor_Kind_configure_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: configure - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: configure + * - title: */ @Override - public void configure() - { + public void configure() { int status = -1; LOGGER.debug("Action configure() called on " + this); // Application State Machine. - switch(getOcciAppState().getValue()) { + switch (getOcciAppState().getValue()) { case Status.DEPLOYED_VALUE: LOGGER.debug("Fire transition(state=deployed, action=\"configure\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.configure(); } - + status = cmtool.configure(this); - if (status == 0) + if (status == 0) { setOcciAppState(Status.INACTIVE); - else + } else { setOcciAppState(Status.ERROR); + } break; default: break; -} + } } + // End of user code // Start of user code Sensor_Kind_Start_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: start - * - title: Start the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: start - + * title: Start the application. */ @Override - public void start() - { + public void start() { int status = -1; LOGGER.debug("Action start() called on " + this); - + // Application State Machine. - switch(getOcciAppState().getValue()) { + switch (getOcciAppState().getValue()) { case Status.INACTIVE_VALUE: LOGGER.debug("Fire transition(state=inactive, action=\"start\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.start(); } status = cmtool.start(this); - if (status == 0) + if (status == 0) { setOcciAppState(Status.ACTIVE); - else - setOcciAppState(Status.ERROR); + } else { + setOcciAppState(Status.ERROR); + } break; - case Status.UNDEPLOYED_VALUE: LOGGER.debug("Fire transition(state=undeployed, action=\"start\")..."); // First deploy components - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.deploy(); } this.deploy(); - + // then configure them - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.configure(); } this.configure(); - + // then start them - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.start(); } status = cmtool.start(this); - - if (status == 0) + + if (status == 0) { setOcciAppState(Status.ACTIVE); - else + } else { setOcciAppState(Status.ERROR); + } break; default: break; -} + } } + // End of user code // Start of user code Sensor_Kind_Stop_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: stop - * - title: Stop the application. + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: stop - + * title: Stop the application. */ @Override - public void stop() - { + public void stop() { int status = -1; LOGGER.debug("Action stop() called on " + this); // Application State Machine. - switch(getOcciAppState().getValue()) { + switch (getOcciAppState().getValue()) { case Status.ACTIVE_VALUE: LOGGER.debug("Fire transition(state=active, action=\"stop\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.stop(); } status = cmtool.stop(this); - if (status == 0) + if (status == 0) { setOcciAppState(Status.INACTIVE); - else - setOcciAppState(Status.ERROR); + } else { + setOcciAppState(Status.ERROR); + } break; default: break; -} + } // TODO: Implement how to stop this sensor. } + // End of user code // Start of user code Sensor_Kind_deploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: deploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: deploy - + * title: */ @Override - public void deploy() - { + public void deploy() { int status = -1; LOGGER.debug("Action deploy() called on " + this); // Application State Machine. - switch(getOcciAppState().getValue()) { + switch (getOcciAppState().getValue()) { case Status.UNDEPLOYED_VALUE: LOGGER.debug("Fire transition(state=undeployed, action=\"deploy\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.deploy(); } - + status = cmtool.deploy(this); - if (status == 0) + if (status == 0) { setOcciAppState(Status.DEPLOYED); - else + } else { setOcciAppState(Status.ERROR); + } break; default: break; -} + } } + // End of user code // Start of user code Sensor_Kind_undeploy_action /** - * Implement OCCI action: - * - scheme: http://schemas.modmacao.org/occi/platform/component/action# - * - term: undeploy - * - title: + * Implement OCCI action: - scheme: + * http://schemas.modmacao.org/occi/platform/component/action# - term: undeploy + * - title: */ @Override - public void undeploy() - { + public void undeploy() { int status = -1; LOGGER.debug("Action undeploy() called on " + this); // Application State Machine. - switch(getOcciAppState().getValue()) { + switch (getOcciAppState().getValue()) { case Status.ACTIVE_VALUE: LOGGER.debug("Fire transition(state=active, action=\"undeploy\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.stop(); } this.stop(); - - for (Component component: this.getConnectedComponents()) { + + for (Component component : this.getConnectedComponents()) { component.undeploy(); } status = cmtool.undeploy(this); - if (status == 0) + if (status == 0) { setOcciAppState(Status.UNDEPLOYED); - else + } else { setOcciAppState(Status.ERROR); + } break; case Status.INACTIVE_VALUE: LOGGER.debug("Fire transition(state=inactive, action=\"undeploy\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.undeploy(); } status = cmtool.undeploy(this); - if (status == 0) + if (status == 0) { setOcciAppState(Status.UNDEPLOYED); - else + } else { setOcciAppState(Status.ERROR); + } break; case Status.DEPLOYED_VALUE: LOGGER.debug("Fire transition(state=deployed, action=\"undeploy\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.undeploy(); } status = cmtool.undeploy(this); - if (status == 0) + if (status == 0) { setOcciAppState(Status.UNDEPLOYED); - else + } else { setOcciAppState(Status.ERROR); + } break; case Status.ERROR_VALUE: LOGGER.debug("Fire transition(state=error, action=\"undeploy\")..."); - for (Component component: this.getConnectedComponents()) { + for (Component component : this.getConnectedComponents()) { component.undeploy(); } status = cmtool.undeploy(this); - if (status == 0) + if (status == 0) { setOcciAppState(Status.UNDEPLOYED); - else + } else { setOcciAppState(Status.ERROR); + } break; default: break; -} + } } // End of user code - + private List<Component> getConnectedComponents() { LinkedList<Component> connectedComponents = new LinkedList<Component>(); - for (Link link: this.getLinks()) { + for (Link link : this.getLinks()) { if (link instanceof Componentlink) { connectedComponents.add((Component) link.getTarget()); } } return connectedComponents; - + } - - + /* - private boolean assertCompsStatusEquals(List<Component> components, Status status) { - for (Component component: components) { - if (component.getOcciComponentState().getValue() != status.getValue()) { - LOGGER.debug("Missmatching state of component " + component.getTitle() + " detected. " - + "Expected " + status.getName() + " but was " - + component.getOcciComponentState().getName() + "."); - return false; - } - } - return true; -}*/ + * private boolean assertCompsStatusEquals(List<Component> components, Status + * status) { for (Component component: components) { if + * (component.getOcciComponentState().getValue() != status.getValue()) { + * LOGGER.debug("Missmatching state of component " + component.getTitle() + + * " detected. " + "Expected " + status.getName() + " but was " + + * component.getOcciComponentState().getName() + "."); return false; } } return + * true; } + */ -} +} diff --git a/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/package-info.java b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..36ab687093d4e8c57f64f5a526fd39be3b748bed --- /dev/null +++ b/de.ugoe.cs.rwm.mocci.connector/src-gen/de/ugoe/cs/rwm/mocci/connector/package-info.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2019 University of Goettingen. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> + *******************************************************************************/ +/** + * + */ +/** + * Main package for mocci connector. + * + * @author erbel + * + */ +package de.ugoe.cs.rwm.mocci.connector; \ No newline at end of file diff --git a/de.ugoe.cs.rwm.mocci.model.edit/build.gradle b/de.ugoe.cs.rwm.mocci.model.edit/build.gradle index 82189e3afce5675625de57d2560ccce699d5ea89..4819b85befd9115d49aecb1998394ff6c9c93420 100644 --- a/de.ugoe.cs.rwm.mocci.model.edit/build.gradle +++ b/de.ugoe.cs.rwm.mocci.model.edit/build.gradle @@ -1,34 +1,10 @@ -// Apply the java-library plugin to add support for Java Library -apply plugin : 'eclipse' -apply plugin: 'java' -apply plugin: 'maven' - - -// In this section you declare where to find the dependencies of your project repositories { - // Use jcenter for resolving your dependencies. - // You can declare any Maven/Ivy/file repository here. - //mavenLocal() - mavenCentral() maven { url "http://www.jabylon.org/maven/" } - - maven { - url "https://nexus.informatik.uni-goettingen.de/content/repositories/thirdparty/" - } - maven { - url "https://nexus.informatik.uni-goettingen.de/content/repositories/rwm/" - } } dependencies { - -//Require-Bundle: org.eclipse.core.runtime, -// org.eclipse.emf.ecore;visibility:=reexport, - - //org.eclipse.ocl.examples.codegen;visibility:=reexport, - //Nexus compile group: 'org.eclipse.ocl', name: 'pivot', version: '1.3.0' compile group: 'org.eclipse.cmf.occi', name: 'core', version: '1.0.0' @@ -40,14 +16,9 @@ dependencies { //maven compile group: 'org.eclipse.emf', name: 'edit', version: '2.9.0' - - - - testCompile group: 'junit', name: 'junit', version: '4.12' } - sourceSets { main { java { diff --git a/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/DatagathererItemProvider.java b/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/DatagathererItemProvider.java index bb7282ee31e13206d8fed2f416aeb2250c753381..53e872d61ba6e5de3f066ceb69c084e30c6ffb3d 100644 --- a/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/DatagathererItemProvider.java +++ b/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/DatagathererItemProvider.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - William Piers <william.piers@obeo.fr> * - Philippe Merle <philippe.merle@inria.fr> @@ -12,39 +12,30 @@ */ package monitoring.provider; - import java.util.Collection; import java.util.List; -import monitoring.Datagatherer; -import monitoring.MonitoringFactory; -import monitoring.MonitoringPackage; - import org.eclipse.cmf.occi.core.OCCIPackage; - import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; - import org.eclipse.emf.common.util.ResourceLocator; - -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ViewerNotification; - import org.modmacao.occi.platform.provider.ComponentItemProvider; +import monitoring.Datagatherer; +import monitoring.MonitoringFactory; + /** - * This is the item provider adapter for a {@link monitoring.Datagatherer} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This is the item provider adapter for a {@link monitoring.Datagatherer} + * object. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public class DatagathererItemProvider extends ComponentItemProvider { /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This constructs an instance from a factory and a notifier. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public DatagathererItemProvider(AdapterFactory adapterFactory) { @@ -52,9 +43,9 @@ public class DatagathererItemProvider extends ComponentItemProvider { } /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This returns the property descriptors for the adapted class. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -67,9 +58,8 @@ public class DatagathererItemProvider extends ComponentItemProvider { } /** - * This returns Datagatherer.gif. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This returns Datagatherer.gif. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -78,25 +68,23 @@ public class DatagathererItemProvider extends ComponentItemProvider { } /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> + * This returns the label text for the adapted class. <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public String getText(Object object) { - String label = ((Datagatherer)object).getId(); - return label == null || label.length() == 0 ? - getString("_UI_Datagatherer_type") : - getString("_UI_Datagatherer_type") + " " + label; + String label = ((Datagatherer) object).getId(); + return label == null || label.length() == 0 ? getString("_UI_Datagatherer_type") + : getString("_UI_Datagatherer_type") + " " + label; } - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This handles model notifications by calling {@link #updateChildren} to update + * any cached children and by creating a viewer notification, which it passes to + * {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -106,31 +94,27 @@ public class DatagathererItemProvider extends ComponentItemProvider { } /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children - * that can be created under this object. - * <!-- begin-user-doc --> + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing + * the children that can be created under this object. <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); - newChildDescriptors.add - (createChildParameter - (OCCIPackage.Literals.ENTITY__PARTS, - MonitoringFactory.eINSTANCE.createOcciresultprovider())); + newChildDescriptors.add(createChildParameter(OCCIPackage.Literals.ENTITY__PARTS, + MonitoringFactory.eINSTANCE.createOcciresultprovider())); - newChildDescriptors.add - (createChildParameter - (OCCIPackage.Literals.RESOURCE__LINKS, - MonitoringFactory.eINSTANCE.createMonitorableproperty())); + newChildDescriptors.add(createChildParameter(OCCIPackage.Literals.RESOURCE__LINKS, + MonitoringFactory.eINSTANCE.createMonitorableproperty())); } /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * Return the resource locator for this item provider's resources. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override diff --git a/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/ResultproviderItemProvider.java b/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/ResultproviderItemProvider.java index c5332a8768262d08419071f2ccc8a87f8b662a5d..cfab51157cb58afba4b02befb0e3caccb78bc4f5 100644 --- a/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/ResultproviderItemProvider.java +++ b/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/ResultproviderItemProvider.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - William Piers <william.piers@obeo.fr> * - Philippe Merle <philippe.merle@inria.fr> @@ -12,39 +12,30 @@ */ package monitoring.provider; - import java.util.Collection; import java.util.List; -import monitoring.MonitoringFactory; -import monitoring.MonitoringPackage; -import monitoring.Resultprovider; - import org.eclipse.cmf.occi.core.OCCIPackage; - import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; - import org.eclipse.emf.common.util.ResourceLocator; - -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ViewerNotification; - import org.modmacao.occi.platform.provider.ComponentItemProvider; +import monitoring.MonitoringFactory; +import monitoring.Resultprovider; + /** - * This is the item provider adapter for a {@link monitoring.Resultprovider} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This is the item provider adapter for a {@link monitoring.Resultprovider} + * object. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public class ResultproviderItemProvider extends ComponentItemProvider { /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This constructs an instance from a factory and a notifier. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public ResultproviderItemProvider(AdapterFactory adapterFactory) { @@ -52,9 +43,9 @@ public class ResultproviderItemProvider extends ComponentItemProvider { } /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This returns the property descriptors for the adapted class. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -67,9 +58,9 @@ public class ResultproviderItemProvider extends ComponentItemProvider { } /** - * This returns Resultprovider.gif. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This returns Resultprovider.gif. <!-- begin-user-doc --> <!-- end-user-doc + * --> + * * @generated */ @Override @@ -78,25 +69,23 @@ public class ResultproviderItemProvider extends ComponentItemProvider { } /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> + * This returns the label text for the adapted class. <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public String getText(Object object) { - String label = ((Resultprovider)object).getId(); - return label == null || label.length() == 0 ? - getString("_UI_Resultprovider_type") : - getString("_UI_Resultprovider_type") + " " + label; + String label = ((Resultprovider) object).getId(); + return label == null || label.length() == 0 ? getString("_UI_Resultprovider_type") + : getString("_UI_Resultprovider_type") + " " + label; } - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This handles model notifications by calling {@link #updateChildren} to update + * any cached children and by creating a viewer notification, which it passes to + * {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -106,31 +95,27 @@ public class ResultproviderItemProvider extends ComponentItemProvider { } /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children - * that can be created under this object. - * <!-- begin-user-doc --> + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing + * the children that can be created under this object. <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); - newChildDescriptors.add - (createChildParameter - (OCCIPackage.Literals.ENTITY__PARTS, - MonitoringFactory.eINSTANCE.createOcciresultprovider())); + newChildDescriptors.add(createChildParameter(OCCIPackage.Literals.ENTITY__PARTS, + MonitoringFactory.eINSTANCE.createOcciresultprovider())); - newChildDescriptors.add - (createChildParameter - (OCCIPackage.Literals.RESOURCE__LINKS, - MonitoringFactory.eINSTANCE.createMonitorableproperty())); + newChildDescriptors.add(createChildParameter(OCCIPackage.Literals.RESOURCE__LINKS, + MonitoringFactory.eINSTANCE.createMonitorableproperty())); } /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * Return the resource locator for this item provider's resources. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override diff --git a/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/SensorItemProvider.java b/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/SensorItemProvider.java index 4f61c46bf880c2a7d85fe551bf87b5b9238e28af..3402dacd4da611f867a415a232522d0905a650ab 100644 --- a/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/SensorItemProvider.java +++ b/de.ugoe.cs.rwm.mocci.model.edit/src-gen/monitoring/provider/SensorItemProvider.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - William Piers <william.piers@obeo.fr> * - Philippe Merle <philippe.merle@inria.fr> @@ -12,39 +12,30 @@ */ package monitoring.provider; - import java.util.Collection; import java.util.List; -import monitoring.MonitoringFactory; -import monitoring.MonitoringPackage; -import monitoring.Sensor; - import org.eclipse.cmf.occi.core.OCCIPackage; - import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; - import org.eclipse.emf.common.util.ResourceLocator; - -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ViewerNotification; - import org.modmacao.occi.platform.provider.ApplicationItemProvider; +import monitoring.MonitoringFactory; +import monitoring.Sensor; + /** * This is the item provider adapter for a {@link monitoring.Sensor} object. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public class SensorItemProvider extends ApplicationItemProvider { /** - * This constructs an instance from a factory and a notifier. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This constructs an instance from a factory and a notifier. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public SensorItemProvider(AdapterFactory adapterFactory) { @@ -52,9 +43,9 @@ public class SensorItemProvider extends ApplicationItemProvider { } /** - * This returns the property descriptors for the adapted class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This returns the property descriptors for the adapted class. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -67,9 +58,8 @@ public class SensorItemProvider extends ApplicationItemProvider { } /** - * This returns Sensor.gif. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This returns Sensor.gif. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -78,25 +68,23 @@ public class SensorItemProvider extends ApplicationItemProvider { } /** - * This returns the label text for the adapted class. - * <!-- begin-user-doc --> + * This returns the label text for the adapted class. <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override public String getText(Object object) { - String label = ((Sensor)object).getId(); - return label == null || label.length() == 0 ? - getString("_UI_Sensor_type") : - getString("_UI_Sensor_type") + " " + label; + String label = ((Sensor) object).getId(); + return label == null || label.length() == 0 ? getString("_UI_Sensor_type") + : getString("_UI_Sensor_type") + " " + label; } - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached - * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * This handles model notifications by calling {@link #updateChildren} to update + * any cached children and by creating a viewer notification, which it passes to + * {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -106,31 +94,27 @@ public class SensorItemProvider extends ApplicationItemProvider { } /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children - * that can be created under this object. - * <!-- begin-user-doc --> + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing + * the children that can be created under this object. <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); - newChildDescriptors.add - (createChildParameter - (OCCIPackage.Literals.ENTITY__PARTS, - MonitoringFactory.eINSTANCE.createOcciresultprovider())); + newChildDescriptors.add(createChildParameter(OCCIPackage.Literals.ENTITY__PARTS, + MonitoringFactory.eINSTANCE.createOcciresultprovider())); - newChildDescriptors.add - (createChildParameter - (OCCIPackage.Literals.RESOURCE__LINKS, - MonitoringFactory.eINSTANCE.createMonitorableproperty())); + newChildDescriptors.add(createChildParameter(OCCIPackage.Literals.RESOURCE__LINKS, + MonitoringFactory.eINSTANCE.createMonitorableproperty())); } /** - * Return the resource locator for this item provider's resources. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * Return the resource locator for this item provider's resources. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override diff --git a/de.ugoe.cs.rwm.mocci.model/build.gradle b/de.ugoe.cs.rwm.mocci.model/build.gradle index f18630ae6e1d46fe2ff1186f08b835858b1d92b6..cd2857aef7e9c9d41e144cac70cc635d4acb2113 100644 --- a/de.ugoe.cs.rwm.mocci.model/build.gradle +++ b/de.ugoe.cs.rwm.mocci.model/build.gradle @@ -1,11 +1,6 @@ -// Apply the java-library plugin to add support for Java Library -apply plugin : 'eclipse' -apply plugin: 'java' -apply plugin: 'maven' apply plugin: 'org.standardout.bnd-platform' //apply plugin: 'osgi' - buildscript { repositories { jcenter() @@ -15,27 +10,7 @@ buildscript { } } - -// In this section you declare where to find the dependencies of your project -repositories { - // Use jcenter for resolving your dependencies. - // You can declare any Maven/Ivy/file repository here. - //mavenLocal() - mavenCentral() - - maven { - url "https://nexus.informatik.uni-goettingen.de/content/repositories/thirdparty/" - } - maven { - url "https://nexus.informatik.uni-goettingen.de/content/repositories/rwm/" - } -} - dependencies { - - //platform 'de.ugoe.cs.rwm.wocci:model:1.0.0' - - //Nexus compile group: 'org.eclipse.ocl', name: 'pivot', version: '1.3.0' //occiware @@ -92,8 +67,6 @@ eclipse { } } - - uploadArchives { repositories { mavenDeployer { diff --git a/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/DatagathererImpl.java b/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/DatagathererImpl.java index 2222d68363b29e0c6f9a861a5ef1296025070451..e94b127ce44ac1dca0fed3fb2132772081850785 100644 --- a/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/DatagathererImpl.java +++ b/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/DatagathererImpl.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - William Piers <william.piers@obeo.fr> * - Philippe Merle <philippe.merle@inria.fr> @@ -12,28 +12,22 @@ */ package monitoring.impl; -import monitoring.Datagatherer; -import monitoring.MonitoringPackage; - -import org.eclipse.emf.common.notify.Notification; - import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - import org.modmacao.occi.platform.impl.ComponentImpl; +import monitoring.Datagatherer; +import monitoring.MonitoringPackage; + /** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Datagatherer</b></em>'. - * <!-- end-user-doc --> + * <!-- begin-user-doc --> An implementation of the model object + * '<em><b>Datagatherer</b></em>'. <!-- end-user-doc --> * * @generated */ public class DatagathererImpl extends ComponentImpl implements Datagatherer { /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected DatagathererImpl() { @@ -41,8 +35,8 @@ public class DatagathererImpl extends ComponentImpl implements Datagatherer { } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -50,4 +44,4 @@ public class DatagathererImpl extends ComponentImpl implements Datagatherer { return MonitoringPackage.Literals.DATAGATHERER; } -} //DatagathererImpl +} // DatagathererImpl diff --git a/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/MonitoringPackageImpl.java b/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/MonitoringPackageImpl.java index fcbecc7879da6903840dd36433f398d902489adc..243f2dce752cc730f693e3195f5fc0cd42e26106 100644 --- a/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/MonitoringPackageImpl.java +++ b/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/MonitoringPackageImpl.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - William Piers <william.piers@obeo.fr> * - Philippe Merle <philippe.merle@inria.fr> @@ -12,20 +12,7 @@ */ package monitoring.impl; -import monitoring.Datagatherer; -import monitoring.Dataprocessor; -import monitoring.Gatheringservice; -import monitoring.Monitorableproperty; -import monitoring.MonitoringFactory; -import monitoring.MonitoringPackage; -import monitoring.Occiresultprovider; -import monitoring.Resultprovider; -import monitoring.Sensor; - -import monitoring.util.MonitoringValidator; - import org.eclipse.cmf.occi.core.OCCIPackage; - import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; @@ -33,77 +20,85 @@ import org.eclipse.emf.ecore.EGenericType; import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EValidator; - import org.eclipse.emf.ecore.impl.EPackageImpl; - import org.modmacao.occi.platform.PlatformPackage; +import monitoring.Datagatherer; +import monitoring.Dataprocessor; +import monitoring.Monitorableproperty; +import monitoring.MonitoringFactory; +import monitoring.MonitoringPackage; +import monitoring.Occiresultprovider; +import monitoring.Resultprovider; +import monitoring.Sensor; +import monitoring.util.MonitoringValidator; + /** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> + * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- + * end-user-doc --> + * * @generated */ public class MonitoringPackageImpl extends EPackageImpl implements MonitoringPackage { /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass sensorEClass = null; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass datagathererEClass = null; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass dataprocessorEClass = null; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass resultproviderEClass = null; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass monitorablepropertyEClass = null; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EClass occiresultproviderEClass = null; /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private EDataType stringEDataType = null; /** * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the + * package package URI value. + * <p> + * Note: the correct way to create the package is via the static factory method + * {@link #init init()}, which also performs initialization of the package, or + * returns the registered package, if one already exists. <!-- begin-user-doc + * --> <!-- end-user-doc --> + * * @see org.eclipse.emf.ecore.EPackage.Registry * @see monitoring.MonitoringPackage#eNS_URI * @see #init() @@ -114,29 +109,36 @@ public class MonitoringPackageImpl extends EPackageImpl implements MonitoringPac } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private static boolean isInited = false; /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * Creates, registers, and initializes the <b>Package</b> for this model, and + * for any others upon which it depends. + * + * <p> + * This method is used to initialize {@link MonitoringPackage#eINSTANCE} when + * that field is accessed. Clients should not invoke it directly. Instead, they + * should simply access that field to obtain the package. <!-- begin-user-doc + * --> <!-- end-user-doc --> * - * <p>This method is used to initialize {@link MonitoringPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() * @generated */ public static MonitoringPackage init() { - if (isInited) return (MonitoringPackage)EPackage.Registry.INSTANCE.getEPackage(MonitoringPackage.eNS_URI); + if (isInited) { + return (MonitoringPackage) EPackage.Registry.INSTANCE.getEPackage(MonitoringPackage.eNS_URI); + } // Obtain or create and register package - MonitoringPackageImpl theMonitoringPackage = (MonitoringPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MonitoringPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new MonitoringPackageImpl()); + MonitoringPackageImpl theMonitoringPackage = (MonitoringPackageImpl) (EPackage.Registry.INSTANCE + .get(eNS_URI) instanceof MonitoringPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) + : new MonitoringPackageImpl()); isInited = true; @@ -151,156 +153,169 @@ public class MonitoringPackageImpl extends EPackageImpl implements MonitoringPac theMonitoringPackage.initializePackageContents(); // Register package validator - EValidator.Registry.INSTANCE.put - (theMonitoringPackage, - new EValidator.Descriptor() { - public EValidator getEValidator() { - return MonitoringValidator.INSTANCE; - } - }); + EValidator.Registry.INSTANCE.put(theMonitoringPackage, new EValidator.Descriptor() { + @Override + public EValidator getEValidator() { + return MonitoringValidator.INSTANCE; + } + }); // Mark meta-data to indicate it can't be changed theMonitoringPackage.freeze(); - // Update the registry and return the package EPackage.Registry.INSTANCE.put(MonitoringPackage.eNS_URI, theMonitoringPackage); return theMonitoringPackage; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EClass getSensor() { return sensorEClass; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EClass getDatagatherer() { return datagathererEClass; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EClass getDataprocessor() { return dataprocessorEClass; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EClass getResultprovider() { return resultproviderEClass; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EClass getMonitorableproperty() { return monitorablepropertyEClass; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getMonitorableproperty_MonitoringProperty() { - return (EAttribute)monitorablepropertyEClass.getEStructuralFeatures().get(0); + return (EAttribute) monitorablepropertyEClass.getEStructuralFeatures().get(0); } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getMonitorableproperty_MonitoringResult() { - return (EAttribute)monitorablepropertyEClass.getEStructuralFeatures().get(1); + return (EAttribute) monitorablepropertyEClass.getEStructuralFeatures().get(1); } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EOperation getMonitorableproperty__TargetConstraint__DiagnosticChain_Map() { return monitorablepropertyEClass.getEOperations().get(0); } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EClass getOcciresultprovider() { return occiresultproviderEClass; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EAttribute getOcciresultprovider_ResultProviderEndpoint() { - return (EAttribute)occiresultproviderEClass.getEStructuralFeatures().get(0); + return (EAttribute) occiresultproviderEClass.getEStructuralFeatures().get(0); } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EOperation getOcciresultprovider__AppliesConstraint__DiagnosticChain_Map() { return occiresultproviderEClass.getEOperations().get(0); } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public EDataType getString() { return stringEDataType; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ + @Override public MonitoringFactory getMonitoringFactory() { - return (MonitoringFactory)getEFactoryInstance(); + return (MonitoringFactory) getEFactoryInstance(); } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private boolean isCreated = false; /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * Creates the meta-model objects for the package. This method is guarded to + * have no affect on any invocation but its first. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * * @generated */ public void createPackageContents() { - if (isCreated) return; + if (isCreated) { + return; + } isCreated = true; // Create classes and their features @@ -326,21 +341,23 @@ public class MonitoringPackageImpl extends EPackageImpl implements MonitoringPac } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ private boolean isInitialized = false; /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * Complete the initialization of the package and its meta-model. This method is + * guarded to have no affect on any invocation but its first. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public void initializePackageContents() { - if (isInitialized) return; + if (isInitialized) { + return; + } isInitialized = true; // Initialize package @@ -349,8 +366,9 @@ public class MonitoringPackageImpl extends EPackageImpl implements MonitoringPac setNsURI(eNS_URI); // Obtain other dependent packages - PlatformPackage thePlatformPackage = (PlatformPackage)EPackage.Registry.INSTANCE.getEPackage(PlatformPackage.eNS_URI); - OCCIPackage theOCCIPackage = (OCCIPackage)EPackage.Registry.INSTANCE.getEPackage(OCCIPackage.eNS_URI); + PlatformPackage thePlatformPackage = (PlatformPackage) EPackage.Registry.INSTANCE + .getEPackage(PlatformPackage.eNS_URI); + OCCIPackage theOCCIPackage = (OCCIPackage) EPackage.Registry.INSTANCE.getEPackage(OCCIPackage.eNS_URI); // Create type parameters @@ -367,17 +385,26 @@ public class MonitoringPackageImpl extends EPackageImpl implements MonitoringPac // Initialize classes, features, and operations; add parameters initEClass(sensorEClass, Sensor.class, "Sensor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEClass(datagathererEClass, Datagatherer.class, "Datagatherer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEClass(datagathererEClass, Datagatherer.class, "Datagatherer", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); - initEClass(dataprocessorEClass, Dataprocessor.class, "Dataprocessor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEClass(dataprocessorEClass, Dataprocessor.class, "Dataprocessor", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); - initEClass(resultproviderEClass, Resultprovider.class, "Resultprovider", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEClass(resultproviderEClass, Resultprovider.class, "Resultprovider", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); - initEClass(monitorablepropertyEClass, Monitorableproperty.class, "Monitorableproperty", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getMonitorableproperty_MonitoringProperty(), this.getString(), "monitoringProperty", null, 1, 1, Monitorableproperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getMonitorableproperty_MonitoringResult(), this.getString(), "monitoringResult", null, 0, 1, Monitorableproperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(monitorablepropertyEClass, Monitorableproperty.class, "Monitorableproperty", !IS_ABSTRACT, + !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getMonitorableproperty_MonitoringProperty(), this.getString(), "monitoringProperty", null, 1, 1, + Monitorableproperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getMonitorableproperty_MonitoringResult(), this.getString(), "monitoringResult", null, 0, 1, + Monitorableproperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - EOperation op = initEOperation(getMonitorableproperty__TargetConstraint__DiagnosticChain_Map(), ecorePackage.getEBoolean(), "targetConstraint", 0, 1, IS_UNIQUE, IS_ORDERED); + EOperation op = initEOperation(getMonitorableproperty__TargetConstraint__DiagnosticChain_Map(), + ecorePackage.getEBoolean(), "targetConstraint", 0, 1, IS_UNIQUE, IS_ORDERED); addEParameter(op, ecorePackage.getEDiagnosticChain(), "diagnostics", 0, 1, IS_UNIQUE, IS_ORDERED); EGenericType g1 = createEGenericType(ecorePackage.getEMap()); EGenericType g2 = createEGenericType(ecorePackage.getEJavaObject()); @@ -386,10 +413,14 @@ public class MonitoringPackageImpl extends EPackageImpl implements MonitoringPac g1.getETypeArguments().add(g2); addEParameter(op, g1, "context", 0, 1, IS_UNIQUE, IS_ORDERED); - initEClass(occiresultproviderEClass, Occiresultprovider.class, "Occiresultprovider", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getOcciresultprovider_ResultProviderEndpoint(), this.getString(), "resultProviderEndpoint", null, 1, 1, Occiresultprovider.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(occiresultproviderEClass, Occiresultprovider.class, "Occiresultprovider", !IS_ABSTRACT, + !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getOcciresultprovider_ResultProviderEndpoint(), this.getString(), "resultProviderEndpoint", null, + 1, 1, Occiresultprovider.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - op = initEOperation(getOcciresultprovider__AppliesConstraint__DiagnosticChain_Map(), ecorePackage.getEBoolean(), "appliesConstraint", 0, 1, IS_UNIQUE, IS_ORDERED); + op = initEOperation(getOcciresultprovider__AppliesConstraint__DiagnosticChain_Map(), ecorePackage.getEBoolean(), + "appliesConstraint", 0, 1, IS_UNIQUE, IS_ORDERED); addEParameter(op, ecorePackage.getEDiagnosticChain(), "diagnostics", 0, 1, IS_UNIQUE, IS_ORDERED); g1 = createEGenericType(ecorePackage.getEMap()); g2 = createEGenericType(ecorePackage.getEJavaObject()); @@ -411,29 +442,15 @@ public class MonitoringPackageImpl extends EPackageImpl implements MonitoringPac /** * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected void createEcoreAnnotations() { - String source = "http://www.eclipse.org/emf/2002/Ecore"; - addAnnotation - (this, - source, - new String[] { - }); - addAnnotation - (monitorablepropertyEClass, - source, - new String[] { - "constraints", "targetConstraint" - }); - addAnnotation - (occiresultproviderEClass, - source, - new String[] { - "constraints", "appliesConstraint" - }); + String source = "http://www.eclipse.org/emf/2002/Ecore"; + addAnnotation(this, source, new String[] {}); + addAnnotation(monitorablepropertyEClass, source, new String[] { "constraints", "targetConstraint" }); + addAnnotation(occiresultproviderEClass, source, new String[] { "constraints", "appliesConstraint" }); } -} //MonitoringPackageImpl +} // MonitoringPackageImpl diff --git a/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/ResultproviderImpl.java b/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/ResultproviderImpl.java index 1ccbd2e50027138633e26b44ce8a8f500dfed4c2..801e09658a90b2999b55ce29425af28c175d65a4 100644 --- a/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/ResultproviderImpl.java +++ b/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/ResultproviderImpl.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - William Piers <william.piers@obeo.fr> * - Philippe Merle <philippe.merle@inria.fr> @@ -12,28 +12,22 @@ */ package monitoring.impl; -import monitoring.MonitoringPackage; -import monitoring.Resultprovider; - -import org.eclipse.emf.common.notify.Notification; - import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - import org.modmacao.occi.platform.impl.ComponentImpl; +import monitoring.MonitoringPackage; +import monitoring.Resultprovider; + /** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Resultprovider</b></em>'. - * <!-- end-user-doc --> + * <!-- begin-user-doc --> An implementation of the model object + * '<em><b>Resultprovider</b></em>'. <!-- end-user-doc --> * * @generated */ public class ResultproviderImpl extends ComponentImpl implements Resultprovider { /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected ResultproviderImpl() { @@ -41,8 +35,8 @@ public class ResultproviderImpl extends ComponentImpl implements Resultprovider } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -50,4 +44,4 @@ public class ResultproviderImpl extends ComponentImpl implements Resultprovider return MonitoringPackage.Literals.RESULTPROVIDER; } -} //ResultproviderImpl +} // ResultproviderImpl diff --git a/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/SensorImpl.java b/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/SensorImpl.java index 7967a306410820e81bda1482463008b1f0cfdb67..b80c47402d3799e4af9ad9a56dc8e692bd18011a 100644 --- a/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/SensorImpl.java +++ b/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/impl/SensorImpl.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - William Piers <william.piers@obeo.fr> * - Philippe Merle <philippe.merle@inria.fr> @@ -12,28 +12,22 @@ */ package monitoring.impl; -import monitoring.MonitoringPackage; -import monitoring.Sensor; - -import org.eclipse.emf.common.notify.Notification; - import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - import org.modmacao.occi.platform.impl.ApplicationImpl; +import monitoring.MonitoringPackage; +import monitoring.Sensor; + /** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Sensor</b></em>'. - * <!-- end-user-doc --> + * <!-- begin-user-doc --> An implementation of the model object + * '<em><b>Sensor</b></em>'. <!-- end-user-doc --> * * @generated */ public class SensorImpl extends ApplicationImpl implements Sensor { /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ protected SensorImpl() { @@ -41,8 +35,8 @@ public class SensorImpl extends ApplicationImpl implements Sensor { } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override @@ -50,4 +44,4 @@ public class SensorImpl extends ApplicationImpl implements Sensor { return MonitoringPackage.Literals.SENSOR; } -} //SensorImpl +} // SensorImpl diff --git a/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/util/MonitoringValidator.java b/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/util/MonitoringValidator.java index 1df82fa8d4a2b66979a47884f306ff85c063ca34..1ca3e81a2ebe3c704be390c449c117325475731a 100644 --- a/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/util/MonitoringValidator.java +++ b/de.ugoe.cs.rwm.mocci.model/src-gen/monitoring/util/MonitoringValidator.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - William Piers <william.piers@obeo.fr> * - Philippe Merle <philippe.merle@inria.fr> @@ -14,42 +14,40 @@ package monitoring.util; import java.util.Map; -import monitoring.*; - import org.eclipse.cmf.occi.core.util.OCCIValidator; - import org.eclipse.emf.common.util.DiagnosticChain; import org.eclipse.emf.common.util.ResourceLocator; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.EPackage; - import org.eclipse.emf.ecore.util.EObjectValidator; -import org.eclipse.emf.ecore.xml.type.util.XMLTypeUtil; +import monitoring.Datagatherer; +import monitoring.Dataprocessor; +import monitoring.Monitorableproperty; +import monitoring.MonitoringPackage; +import monitoring.Occiresultprovider; +import monitoring.Resultprovider; +import monitoring.Sensor; /** - * <!-- begin-user-doc --> - * The <b>Validator</b> for the model. - * <!-- end-user-doc --> + * <!-- begin-user-doc --> The <b>Validator</b> for the model. <!-- end-user-doc + * --> + * * @see monitoring.MonitoringPackage * @generated */ public class MonitoringValidator extends EObjectValidator { /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * The cached model package <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public static final MonitoringValidator INSTANCE = new MonitoringValidator(); /** - * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() + * source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() + * codes} from this package. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @see org.eclipse.emf.common.util.Diagnostic#getSource() * @see org.eclipse.emf.common.util.Diagnostic#getCode() * @generated @@ -57,49 +55,53 @@ public class MonitoringValidator extends EObjectValidator { public static final String DIAGNOSTIC_SOURCE = "monitoring"; /** - * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Target Constraint' of 'Monitorableproperty'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for + * constraint 'Target Constraint' of 'Monitorableproperty'. <!-- begin-user-doc + * --> <!-- end-user-doc --> + * * @generated */ public static final int MONITORABLEPROPERTY__TARGET_CONSTRAINT = 1; /** - * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Applies Constraint' of 'Occiresultprovider'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for + * constraint 'Applies Constraint' of 'Occiresultprovider'. <!-- begin-user-doc + * --> <!-- end-user-doc --> + * * @generated */ public static final int OCCIRESULTPROVIDER__APPLIES_CONSTRAINT = 2; /** - * A constant with a fixed name that can be used as the base value for additional hand written constants. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * A constant with a fixed name that can be used as the base value for + * additional hand written constants. <!-- begin-user-doc --> <!-- end-user-doc + * --> + * * @generated */ private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 2; /** - * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. - * <!-- begin-user-doc --> + * A constant with a fixed name that can be used as the base value for + * additional hand written constants in a derived class. <!-- begin-user-doc --> * <!-- end-user-doc --> + * * @generated */ protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; /** - * The cached base package validator. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * The cached base package validator. <!-- begin-user-doc --> <!-- end-user-doc + * --> + * * @generated */ protected OCCIValidator occiValidator; /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * Creates an instance of the switch. <!-- begin-user-doc --> <!-- end-user-doc + * --> + * * @generated */ public MonitoringValidator() { @@ -108,204 +110,371 @@ public class MonitoringValidator extends EObjectValidator { } /** - * Returns the package of this validator switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * Returns the package of this validator switch. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * * @generated */ @Override protected EPackage getEPackage() { - return MonitoringPackage.eINSTANCE; + return MonitoringPackage.eINSTANCE; } /** * Calls <code>validateXXX</code> for the corresponding classifier of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override - protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { + protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, + Map<Object, Object> context) { switch (classifierID) { - case MonitoringPackage.SENSOR: - return validateSensor((Sensor)value, diagnostics, context); - case MonitoringPackage.DATAGATHERER: - return validateDatagatherer((Datagatherer)value, diagnostics, context); - case MonitoringPackage.DATAPROCESSOR: - return validateDataprocessor((Dataprocessor)value, diagnostics, context); - case MonitoringPackage.RESULTPROVIDER: - return validateResultprovider((Resultprovider)value, diagnostics, context); - case MonitoringPackage.MONITORABLEPROPERTY: - return validateMonitorableproperty((Monitorableproperty)value, diagnostics, context); - case MonitoringPackage.OCCIRESULTPROVIDER: - return validateOcciresultprovider((Occiresultprovider)value, diagnostics, context); - case MonitoringPackage.STRING: - return validateString((String)value, diagnostics, context); - default: - return true; + case MonitoringPackage.SENSOR: + return validateSensor((Sensor) value, diagnostics, context); + case MonitoringPackage.DATAGATHERER: + return validateDatagatherer((Datagatherer) value, diagnostics, context); + case MonitoringPackage.DATAPROCESSOR: + return validateDataprocessor((Dataprocessor) value, diagnostics, context); + case MonitoringPackage.RESULTPROVIDER: + return validateResultprovider((Resultprovider) value, diagnostics, context); + case MonitoringPackage.MONITORABLEPROPERTY: + return validateMonitorableproperty((Monitorableproperty) value, diagnostics, context); + case MonitoringPackage.OCCIRESULTPROVIDER: + return validateOcciresultprovider((Occiresultprovider) value, diagnostics, context); + case MonitoringPackage.STRING: + return validateString((String) value, diagnostics, context); + default: + return true; } } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public boolean validateSensor(Sensor sensor, DiagnosticChain diagnostics, Map<Object, Object> context) { - if (!validate_NoCircularContainment(sensor, diagnostics, context)) return false; + if (!validate_NoCircularContainment(sensor, diagnostics, context)) { + return false; + } boolean result = validate_EveryMultiplicityConforms(sensor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryDataValueConforms(sensor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(sensor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(sensor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryProxyResolves(sensor, diagnostics, context); - if (result || diagnostics != null) result &= validate_UniqueID(sensor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryKeyUnique(sensor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(sensor, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_IdUnique(sensor, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_AttributesNameUnique(sensor, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_KindCompatibleWithOneAppliesOfEachMixin(sensor, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_DifferentMixins(sensor, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateResource_ResourceKindIsInParent(sensor, diagnostics, context); + if (result || diagnostics != null) { + result &= validate_EveryDataValueConforms(sensor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryReferenceIsContained(sensor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryBidirectionalReferenceIsPaired(sensor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryProxyResolves(sensor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_UniqueID(sensor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryKeyUnique(sensor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryMapEntryUnique(sensor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_IdUnique(sensor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_AttributesNameUnique(sensor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_KindCompatibleWithOneAppliesOfEachMixin(sensor, diagnostics, + context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_DifferentMixins(sensor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateResource_ResourceKindIsInParent(sensor, diagnostics, context); + } return result; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ - public boolean validateDatagatherer(Datagatherer datagatherer, DiagnosticChain diagnostics, Map<Object, Object> context) { - if (!validate_NoCircularContainment(datagatherer, diagnostics, context)) return false; + public boolean validateDatagatherer(Datagatherer datagatherer, DiagnosticChain diagnostics, + Map<Object, Object> context) { + if (!validate_NoCircularContainment(datagatherer, diagnostics, context)) { + return false; + } boolean result = validate_EveryMultiplicityConforms(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryDataValueConforms(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryProxyResolves(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= validate_UniqueID(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryKeyUnique(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_IdUnique(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_AttributesNameUnique(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_KindCompatibleWithOneAppliesOfEachMixin(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_DifferentMixins(datagatherer, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateResource_ResourceKindIsInParent(datagatherer, diagnostics, context); + if (result || diagnostics != null) { + result &= validate_EveryDataValueConforms(datagatherer, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryReferenceIsContained(datagatherer, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryBidirectionalReferenceIsPaired(datagatherer, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryProxyResolves(datagatherer, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_UniqueID(datagatherer, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryKeyUnique(datagatherer, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryMapEntryUnique(datagatherer, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_IdUnique(datagatherer, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_AttributesNameUnique(datagatherer, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_KindCompatibleWithOneAppliesOfEachMixin(datagatherer, diagnostics, + context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_DifferentMixins(datagatherer, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateResource_ResourceKindIsInParent(datagatherer, diagnostics, context); + } return result; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ - public boolean validateDataprocessor(Dataprocessor dataprocessor, DiagnosticChain diagnostics, Map<Object, Object> context) { - if (!validate_NoCircularContainment(dataprocessor, diagnostics, context)) return false; + public boolean validateDataprocessor(Dataprocessor dataprocessor, DiagnosticChain diagnostics, + Map<Object, Object> context) { + if (!validate_NoCircularContainment(dataprocessor, diagnostics, context)) { + return false; + } boolean result = validate_EveryMultiplicityConforms(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryDataValueConforms(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryProxyResolves(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= validate_UniqueID(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryKeyUnique(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_IdUnique(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_AttributesNameUnique(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_KindCompatibleWithOneAppliesOfEachMixin(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_DifferentMixins(dataprocessor, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateResource_ResourceKindIsInParent(dataprocessor, diagnostics, context); + if (result || diagnostics != null) { + result &= validate_EveryDataValueConforms(dataprocessor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryReferenceIsContained(dataprocessor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryBidirectionalReferenceIsPaired(dataprocessor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryProxyResolves(dataprocessor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_UniqueID(dataprocessor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryKeyUnique(dataprocessor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryMapEntryUnique(dataprocessor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_IdUnique(dataprocessor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_AttributesNameUnique(dataprocessor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_KindCompatibleWithOneAppliesOfEachMixin(dataprocessor, diagnostics, + context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_DifferentMixins(dataprocessor, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateResource_ResourceKindIsInParent(dataprocessor, diagnostics, context); + } return result; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ - public boolean validateResultprovider(Resultprovider resultprovider, DiagnosticChain diagnostics, Map<Object, Object> context) { - if (!validate_NoCircularContainment(resultprovider, diagnostics, context)) return false; + public boolean validateResultprovider(Resultprovider resultprovider, DiagnosticChain diagnostics, + Map<Object, Object> context) { + if (!validate_NoCircularContainment(resultprovider, diagnostics, context)) { + return false; + } boolean result = validate_EveryMultiplicityConforms(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryDataValueConforms(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryProxyResolves(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_UniqueID(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryKeyUnique(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_IdUnique(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_AttributesNameUnique(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_KindCompatibleWithOneAppliesOfEachMixin(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_DifferentMixins(resultprovider, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateResource_ResourceKindIsInParent(resultprovider, diagnostics, context); + if (result || diagnostics != null) { + result &= validate_EveryDataValueConforms(resultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryReferenceIsContained(resultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryBidirectionalReferenceIsPaired(resultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryProxyResolves(resultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_UniqueID(resultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryKeyUnique(resultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryMapEntryUnique(resultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_IdUnique(resultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_AttributesNameUnique(resultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_KindCompatibleWithOneAppliesOfEachMixin(resultprovider, diagnostics, + context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_DifferentMixins(resultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateResource_ResourceKindIsInParent(resultprovider, diagnostics, context); + } return result; } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ - public boolean validateMonitorableproperty(Monitorableproperty monitorableproperty, DiagnosticChain diagnostics, Map<Object, Object> context) { - if (!validate_NoCircularContainment(monitorableproperty, diagnostics, context)) return false; + public boolean validateMonitorableproperty(Monitorableproperty monitorableproperty, DiagnosticChain diagnostics, + Map<Object, Object> context) { + if (!validate_NoCircularContainment(monitorableproperty, diagnostics, context)) { + return false; + } boolean result = validate_EveryMultiplicityConforms(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryDataValueConforms(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryProxyResolves(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= validate_UniqueID(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryKeyUnique(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_IdUnique(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_AttributesNameUnique(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_KindCompatibleWithOneAppliesOfEachMixin(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateEntity_DifferentMixins(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateLink_LinkKindIsInParent(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateLink_sourceReferenceInvariant(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= occiValidator.validateLink_targetReferenceInvariant(monitorableproperty, diagnostics, context); - if (result || diagnostics != null) result &= validateMonitorableproperty_targetConstraint(monitorableproperty, diagnostics, context); + if (result || diagnostics != null) { + result &= validate_EveryDataValueConforms(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryReferenceIsContained(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryBidirectionalReferenceIsPaired(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryProxyResolves(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_UniqueID(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryKeyUnique(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryMapEntryUnique(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_IdUnique(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_AttributesNameUnique(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_KindCompatibleWithOneAppliesOfEachMixin(monitorableproperty, + diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateEntity_DifferentMixins(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateLink_LinkKindIsInParent(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateLink_sourceReferenceInvariant(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= occiValidator.validateLink_targetReferenceInvariant(monitorableproperty, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validateMonitorableproperty_targetConstraint(monitorableproperty, diagnostics, context); + } return result; } /** * Validates the targetConstraint constraint of '<em>Monitorableproperty</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ - public boolean validateMonitorableproperty_targetConstraint(Monitorableproperty monitorableproperty, DiagnosticChain diagnostics, Map<Object, Object> context) { + public boolean validateMonitorableproperty_targetConstraint(Monitorableproperty monitorableproperty, + DiagnosticChain diagnostics, Map<Object, Object> context) { return monitorableproperty.targetConstraint(diagnostics, context); } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ - public boolean validateOcciresultprovider(Occiresultprovider occiresultprovider, DiagnosticChain diagnostics, Map<Object, Object> context) { - if (!validate_NoCircularContainment(occiresultprovider, diagnostics, context)) return false; + public boolean validateOcciresultprovider(Occiresultprovider occiresultprovider, DiagnosticChain diagnostics, + Map<Object, Object> context) { + if (!validate_NoCircularContainment(occiresultprovider, diagnostics, context)) { + return false; + } boolean result = validate_EveryMultiplicityConforms(occiresultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryDataValueConforms(occiresultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(occiresultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(occiresultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryProxyResolves(occiresultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_UniqueID(occiresultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryKeyUnique(occiresultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(occiresultprovider, diagnostics, context); - if (result || diagnostics != null) result &= validateOcciresultprovider_appliesConstraint(occiresultprovider, diagnostics, context); + if (result || diagnostics != null) { + result &= validate_EveryDataValueConforms(occiresultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryReferenceIsContained(occiresultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryBidirectionalReferenceIsPaired(occiresultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryProxyResolves(occiresultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_UniqueID(occiresultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryKeyUnique(occiresultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validate_EveryMapEntryUnique(occiresultprovider, diagnostics, context); + } + if (result || diagnostics != null) { + result &= validateOcciresultprovider_appliesConstraint(occiresultprovider, diagnostics, context); + } return result; } /** * Validates the appliesConstraint constraint of '<em>Occiresultprovider</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ - public boolean validateOcciresultprovider_appliesConstraint(Occiresultprovider occiresultprovider, DiagnosticChain diagnostics, Map<Object, Object> context) { + public boolean validateOcciresultprovider_appliesConstraint(Occiresultprovider occiresultprovider, + DiagnosticChain diagnostics, Map<Object, Object> context) { return occiresultprovider.appliesConstraint(diagnostics, context); } /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ public boolean validateString(String string, DiagnosticChain diagnostics, Map<Object, Object> context) { @@ -313,17 +482,18 @@ public class MonitoringValidator extends EObjectValidator { } /** - * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> + * Returns the resource locator that will be used to fetch messages for this + * validator's diagnostics. <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated */ @Override public ResourceLocator getResourceLocator() { // TODO - // Specialize this to return a resource locator for messages specific to this validator. + // Specialize this to return a resource locator for messages specific to this + // validator. // Ensure that you remove @generated or mark it @generated NOT return super.getResourceLocator(); } -} //MonitoringValidator +} // MonitoringValidator diff --git a/src/main/java/de/ugoe/cs/rwm/mocci/AbsScaler.java b/src/main/java/de/ugoe/cs/rwm/mocci/AbsScaler.java index 46c11a6940d2f93f6c9a703999986d15d9bf483e..0e81ad2a3b12e44408c615e96fc7c0217e3791e3 100644 --- a/src/main/java/de/ugoe/cs/rwm/mocci/AbsScaler.java +++ b/src/main/java/de/ugoe/cs/rwm/mocci/AbsScaler.java @@ -4,10 +4,11 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> */ + package de.ugoe.cs.rwm.mocci; import java.nio.file.Path; @@ -35,7 +36,8 @@ public abstract class AbsScaler { protected Resource runtimeModel; protected Connector conn; protected Path runtimePath; - + + @SuppressWarnings("serial") static List<String> interfaces = new ArrayList<String>() { { add("10.254.1.12"); @@ -45,11 +47,11 @@ public abstract class AbsScaler { add("10.254.1.52"); } }; - - - protected org.eclipse.cmf.occi.core.Resource getResourceById(EList<org.eclipse.cmf.occi.core.Resource> eList, String string) { - for(org.eclipse.cmf.occi.core.Resource res: eList ) { - if(res.getId().equals(string)) { + + protected org.eclipse.cmf.occi.core.Resource getResourceById(EList<org.eclipse.cmf.occi.core.Resource> eList, + String string) { + for (org.eclipse.cmf.occi.core.Resource res : eList) { + if (res.getId().equals(string)) { return res; } } diff --git a/src/main/java/de/ugoe/cs/rwm/mocci/DownScaler.java b/src/main/java/de/ugoe/cs/rwm/mocci/DownScaler.java index d85d6c35adcc08310d7e5399ff729b61ce40d004..0303043174f4c3862a7a419f9a497dc71c9ecc59 100644 --- a/src/main/java/de/ugoe/cs/rwm/mocci/DownScaler.java +++ b/src/main/java/de/ugoe/cs/rwm/mocci/DownScaler.java @@ -4,10 +4,11 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> */ + package de.ugoe.cs.rwm.mocci; import java.nio.file.Path; @@ -16,9 +17,7 @@ import java.util.List; import org.eclipse.cmf.occi.core.AttributeState; import org.eclipse.cmf.occi.core.Configuration; import org.eclipse.cmf.occi.core.Link; -import org.eclipse.cmf.occi.core.MixinBase; import org.eclipse.cmf.occi.infrastructure.Compute; -import org.eclipse.cmf.occi.infrastructure.Ipnetworkinterface; import org.eclipse.cmf.occi.infrastructure.Networkinterface; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.ecore.resource.Resource; @@ -34,65 +33,65 @@ public class DownScaler extends AbsScaler { private List<Link> linksToDelete; private List<org.eclipse.cmf.occi.core.Resource> resourcesToDelete; - + public DownScaler(Connector conn, Path runtimePath) { - this.conn = conn; + this.conn = conn; this.runtimePath = runtimePath; this.linksToDelete = new BasicEList<Link>(); this.resourcesToDelete = new BasicEList<org.eclipse.cmf.occi.core.Resource>(); } - + public Resource downScaleNodes() { CachedResourceSet.getCache().clear(); runtimeModel = ModelUtility.loadOCCIintoEMFResource(conn.loadRuntimeModel(runtimePath)); Configuration config = ((Configuration) runtimeModel.getContents().get(0)); boolean downScale = false; - - for(org.eclipse.cmf.occi.core.Resource res : config.getResources()) { - if(res instanceof Compute) { + + for (org.eclipse.cmf.occi.core.Resource res : config.getResources()) { + if (res instanceof Compute) { Compute comp = (Compute) res; - if(comp.getTitle().contains("hadoop-worker-additional")) { + if (comp.getTitle().contains("hadoop-worker-additional")) { Monitorableproperty monProp = getAttachedCPUMonProp(comp); - if(monProp != null && monProp.getMonitoringResult() != null) { - if(monProp.getMonitoringResult().equals("None")) { + if (monProp != null && monProp.getMonitoringResult() != null) { + if (monProp.getMonitoringResult().equals("None")) { System.out.println(" VM with None CPU utilization found: " + comp.getId()); addConnectedLinksAndComponents(comp); resourcesToDelete.add(comp); - System.out.println(" Deleting Entities Around: " + comp.getTitle() +" ("+comp.getId()+")"); + System.out.println( + " Delete Entities Around: " + comp.getTitle() + " (" + comp.getId() + ")"); downScale = true; break; } } - } + } } } - - if(downScale == false) { + + if (downScale == false) { System.out.println(" Every Compute busy/Only one worker! Skipping downScale!"); } - for(Link link: linksToDelete) { + for (Link link : linksToDelete) { EcoreUtil.delete(link); } config.getResources().removeAll(resourcesToDelete); - - for(org.eclipse.cmf.occi.core.Resource res: resourcesToDelete) { + + for (org.eclipse.cmf.occi.core.Resource res : resourcesToDelete) { EcoreUtil.delete(res); } Resource rM = runtimeModel; MAPE.newComp = null; CachedResourceSet.getCache().clear(); return rM; - - } + } private Monitorableproperty getAttachedCPUMonProp(Compute comp) { - for(Link link: comp.getRlinks()) { - if(link instanceof Monitorableproperty) { + for (Link link : comp.getRlinks()) { + if (link instanceof Monitorableproperty) { Monitorableproperty monProp = (Monitorableproperty) link; - if(monProp.getMonitoringProperty().equals("CPU")) { + if (monProp.getMonitoringProperty().equals("CPU")) { return monProp; } } @@ -103,38 +102,34 @@ public class DownScaler extends AbsScaler { private void addConnectedLinksAndComponents(Compute comp) { linksToDelete.addAll(comp.getLinks()); linksToDelete.addAll(comp.getRlinks()); - - for(Link link: comp.getRlinks()) { - if(link.getSource() instanceof Component) { + + for (Link link : comp.getRlinks()) { + if (link.getSource() instanceof Component) { resourcesToDelete.add(link.getSource()); linksToDelete.addAll(link.getSource().getLinks()); linksToDelete.addAll(link.getSource().getRlinks()); } - if(link instanceof Monitorableproperty) { + if (link instanceof Monitorableproperty) { resourcesToDelete.add(link.getSource()); } } - - for(Link link: comp.getLinks()) { - if(link instanceof Networkinterface) { + + for (Link link : comp.getLinks()) { + if (link instanceof Networkinterface) { Networkinterface nwi = (Networkinterface) link; - for(AttributeState attr: nwi.getAttributes()) { - if(attr.getName().equals("occi.networkinterface.address")) { - if(attr.getValue().startsWith("10.254.1")){ + for (AttributeState attr : nwi.getAttributes()) { + if (attr.getName().equals("occi.networkinterface.address")) { + if (attr.getValue().startsWith("10.254.1")) { interfaces.add(attr.getValue()); } } } /* - for(MixinBase mixB: nwi.getParts()) { - if(mixB instanceof Ipnetworkinterface) { - Ipnetworkinterface ipnwi = (Ipnetworkinterface) mixB; - if(ipnwi.getOcciNetworkinterfaceAddress().startsWith("100.254.1")) { - interfaces.add(ipnwi.getOcciNetworkinterfaceAddress()); - } - } - } - */ + * for(MixinBase mixB: nwi.getParts()) { if(mixB instanceof Ipnetworkinterface) + * { Ipnetworkinterface ipnwi = (Ipnetworkinterface) mixB; + * if(ipnwi.getOcciNetworkinterfaceAddress().startsWith("100.254.1")) { + * interfaces.add(ipnwi.getOcciNetworkinterfaceAddress()); } } } + */ } } } diff --git a/src/main/java/de/ugoe/cs/rwm/mocci/InitialDeployment.java b/src/main/java/de/ugoe/cs/rwm/mocci/InitialDeployment.java index 8708107f874f7969130ea2113fe5fa82ddfbc888..b478bf8b5f2aed95ef5f1831f24542cac10ab332 100644 --- a/src/main/java/de/ugoe/cs/rwm/mocci/InitialDeployment.java +++ b/src/main/java/de/ugoe/cs/rwm/mocci/InitialDeployment.java @@ -4,10 +4,11 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> */ + package de.ugoe.cs.rwm.mocci; import java.io.File; @@ -17,9 +18,9 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.nio.file.Path; -import java.nio.file.Paths; import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.epsilon.eol.exceptions.EolRuntimeException; import de.ugoe.cs.rwm.docci.MartDeployer; import de.ugoe.cs.rwm.docci.ModelUtility; @@ -32,38 +33,50 @@ import de.ugoe.cs.rwm.tocci.TransformatorFactory; import de.ugoe.cs.rwm.tocci.occi2openstack.OCCI2OPENSTACKTransformator; public class InitialDeployment { - - public static void main (String args[]) { + + public static void main(String args[]) { Connector conn = new LocalhostConnector("localhost", 8080, "ubuntu"); - //Connector conn = new MartConnector("192.168.35.45", 8080, "ubuntu", "~/key.pem"); + // Connector conn = new MartConnector("192.168.35.45", 8080, "ubuntu", + // "~/key.pem"); RegistryAndLoggerSetup.setup(); Path occiPath; - - if(args.length == 0) { + + if (args.length == 0) { System.out.println("Choosing default initial deployment model"); occiPath = getModelPath("de/ugoe/cs/rwm/mocci/occi/hadoopClusterCPU.occic"); } else { System.out.println("Choosing user defined deployment model: " + args[0]); - File occiFile = new File(args[0]); + File occiFile = new File(args[0]); occiPath = occiFile.toPath().toAbsolutePath(); } - + Resource model = ModelUtility.loadOCCIintoEMFResource(occiPath); - + Transformator trans = TransformatorFactory.getTransformator("OCCI2OCCI"); - trans.transform(model, occiPath); + try { + trans.transform(model, occiPath); + } catch (EolRuntimeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } model = ModelUtility.loadOCCIintoEMFResource(occiPath); - - OCCI2OPENSTACKTransformator trans2 = OCCI2OPENSTACKTransformator.getInstance(); - trans2.setTransformationProperties(RegistryAndLoggerSetup.manNWRuntimeId, RegistryAndLoggerSetup.sshKey, RegistryAndLoggerSetup.userData, RegistryAndLoggerSetup.manNWid); - - trans2.transform(model, occiPath); - + + OCCI2OPENSTACKTransformator trans2 = new OCCI2OPENSTACKTransformator(); + trans2.setTransformationProperties(RegistryAndLoggerSetup.manNWRuntimeId, RegistryAndLoggerSetup.sshKey, + RegistryAndLoggerSetup.userData, RegistryAndLoggerSetup.manNWid); + + try { + trans2.transform(model, occiPath); + } catch (EolRuntimeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + model = ModelUtility.loadOCCIintoEMFResource(occiPath); - + MartDeployer deployer; - if(conn instanceof MartConnector) { + if (conn instanceof MartConnector) { deployer = new MartDeployer(conn, 100000); } else { deployer = new MartDeployer(conn); @@ -72,7 +85,7 @@ public class InitialDeployment { MartExecutor executor = new MartExecutor(conn); executor.executeGetOperation("/resultprovider"); } - + public static Path getModelPath(String resourceName) { File file = null; URL res = ClassLoader.getSystemClassLoader().getResource(resourceName); diff --git a/src/main/java/de/ugoe/cs/rwm/mocci/MAPE.java b/src/main/java/de/ugoe/cs/rwm/mocci/MAPE.java index a2f9dcd4c3f119727a549daac97269ffa69b1549..03431ed2952e5fe60c6e1fc36c0342e7fd77c2e8 100644 --- a/src/main/java/de/ugoe/cs/rwm/mocci/MAPE.java +++ b/src/main/java/de/ugoe/cs/rwm/mocci/MAPE.java @@ -4,52 +4,61 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> */ + package de.ugoe.cs.rwm.mocci; import java.nio.file.Path; import java.nio.file.Paths; + import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.epsilon.eol.exceptions.EolRuntimeException; import org.json.JSONArray; +import org.modmacao.occi.platform.Component; import de.ugoe.cs.rwm.docci.MartDeployer; import de.ugoe.cs.rwm.docci.ModelUtility; import de.ugoe.cs.rwm.docci.connector.Connector; -import de.ugoe.cs.rwm.docci.connector.LocalhostConnector; +import de.ugoe.cs.rwm.docci.connector.LocalhostConnector; import de.ugoe.cs.rwm.docci.connector.MartConnector; import de.ugoe.cs.rwm.docci.executor.MartExecutor; import de.ugoe.cs.rwm.tocci.occi2openstack.OCCI2OPENSTACKTransformator; -import org.modmacao.occi.platform.Component; - -/**Making javadoc happy. +/** + * Making javadoc happy. + * * @author erbel * */ public class MAPE { protected static final Path RUNTIMEPATH = Paths.get(System.getProperty("user.home") + "/.rwm/runtime.occic"); static Connector conn = new LocalhostConnector("localhost", 8080, "ubuntu"); - //static Connector conn = new MartConnector("192.168.35.45", 8080, "ubuntu", "~/key.pem"); + // static Connector conn = new MartConnector("192.168.35.45", 8080, "ubuntu", + // "~/key.pem"); static MartExecutor executor = new MartExecutor(conn); static Resource runtimeModel; static Component newComp; static int interval = 10000; - - /**Making javadoc happy. - * @param args Making javadoc happy. + + /** + * Making javadoc happy. + * + * @param args + * Making javadoc happy. */ public static void main(String[] args) { System.out.println("Starting MAPE loop"); RegistryAndLoggerSetup.setup(); - - while(true) { + + while (true) { try { - System.out.println("\n--------------------Waiting for new MAPE-K Cycle: Sleeping " + interval +"--------------------"); + System.out.println("\n--------------------Waiting for new MAPE-K Cycle: Sleeping " + interval + + "--------------------"); Thread.sleep(interval); - + Monitor monitor = monitor(); String analysis = analyze(monitor); runtimeModel = plan(analysis); @@ -57,120 +66,125 @@ public class MAPE { } catch (InterruptedException e) { e.printStackTrace(); } - + } } -public static Monitor monitor() { + public static Monitor monitor() { int critCPUs = getNumberOfCriticalCPUs(); int noneCPUs = getNumberOfNoneCPUs(); int allCPUs = getNumberOfAllCPUs(); Monitor mon = new Monitor(critCPUs, noneCPUs, allCPUs); - System.out.println("Monitor: " + "Monitored CPUs: " + allCPUs + "| Critical CPUs: "+ critCPUs + "| None CPUs: " + noneCPUs); + System.out.println("Monitor: " + "Monitored CPUs: " + allCPUs + "| Critical CPUs: " + critCPUs + "| None CPUs: " + + noneCPUs); return mon; -} - - -public static String analyze(Monitor monitor) { - int noneCPUs = monitor.getNoneCPUs(); - int critCPUs = monitor.getCritCPUs(); - int allCPUs = monitor.getAllCPUs(); - - if(noneCPUs == 0 && critCPUs > allCPUs/2 && allCPUs <= 6){ - System.out.println("Analyze: Critical State Detected"); - return "upScale"; - } else { - System.out.println("Analyze: Non Critical State Detected"); - return "downScale"; - } -} - -public static Resource plan(String analysis) { - switch (analysis) { - case "upScale": System.out.println("Plan: upScale!"); - UpScaler upscaler = new UpScaler(conn, RUNTIMEPATH); - return upscaler.upScaleNodes(); - case "downScale": System.out.println("Plan: downScale!"); - DownScaler downscaler = new DownScaler(conn, RUNTIMEPATH); - return downscaler.downScaleNodes(); } - return null; -} + public static String analyze(Monitor monitor) { + int noneCPUs = monitor.getNoneCPUs(); + int critCPUs = monitor.getCritCPUs(); + int allCPUs = monitor.getAllCPUs(); -public static void execute(Resource runtimeModel) { - System.out.println("Execute: Deploying adjusted Model"); + if (noneCPUs == 0 && critCPUs > allCPUs / 2 && allCPUs <= 6) { + System.out.println("Analyze: Critical State Detected"); + return "upScale"; + } else { + System.out.println("Analyze: Non Critical State Detected"); + return "downScale"; + } + } + + public static Resource plan(String analysis) { + switch (analysis) { + case "upScale": + System.out.println("Plan: upScale!"); + UpScaler upscaler = new UpScaler(conn, RUNTIMEPATH); + return upscaler.upScaleNodes(); + case "downScale": + System.out.println("Plan: downScale!"); + DownScaler downscaler = new DownScaler(conn, RUNTIMEPATH); + return downscaler.downScaleNodes(); + } + return null; + } + + public static void execute(Resource runtimeModel) { + System.out.println("Execute: Deploying adjusted Model"); Path occiPath = RUNTIMEPATH; - - OCCI2OPENSTACKTransformator trans2 = OCCI2OPENSTACKTransformator.getInstance(); - trans2.setTransformationProperties(RegistryAndLoggerSetup.manNWRuntimeId, RegistryAndLoggerSetup.sshKey, RegistryAndLoggerSetup.userData, RegistryAndLoggerSetup.manNWid); - - trans2.transform(runtimeModel, occiPath); - + + OCCI2OPENSTACKTransformator trans2 = new OCCI2OPENSTACKTransformator(); + trans2.setTransformationProperties(RegistryAndLoggerSetup.manNWRuntimeId, RegistryAndLoggerSetup.sshKey, + RegistryAndLoggerSetup.userData, RegistryAndLoggerSetup.manNWid); + + try { + trans2.transform(runtimeModel, occiPath); + } catch (EolRuntimeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + runtimeModel = ModelUtility.loadOCCIintoEMFResource(occiPath); - + MartDeployer deployer; - if(conn instanceof MartConnector) { + if (conn instanceof MartConnector) { deployer = new MartDeployer(conn, 100000); } else { deployer = new MartDeployer(conn); } deployer.deploy(runtimeModel); - - if(newComp != null) { + + if (newComp != null) { executor.executeOperation("POST", newComp, ModelUtility.getAction(newComp, "start")); } } - - -private static int getNumberOfNoneCPUs() { - String query = "/monitorableproperty?attribute=monitoring.result&value=None"; - String result = executor.executeGetOperation(query); - if(result.equals("{ }") == false) { - String substring = result.substring(result.indexOf("["), (result.lastIndexOf("]")+1)); - JSONArray arr = new JSONArray(substring); - if(arr.length() == 0) { - return 1; + private static int getNumberOfNoneCPUs() { + String query = "/monitorableproperty?attribute=monitoring.result&value=None"; + String result = executor.executeGetOperation(query); + if (result.equals("{ }") == false) { + String substring = result.substring(result.indexOf("["), (result.lastIndexOf("]") + 1)); + JSONArray arr = new JSONArray(substring); + if (arr.length() == 0) { + return 1; + } else { + return arr.length(); + } } else { - return arr.length(); + return 0; } - } else { - return 0; + } - -} - -private static int getNumberOfCriticalCPUs() { - String query = "/monitorableproperty?attribute=monitoring.result&value=Critical"; - String result = executor.executeGetOperation(query); - if(result.equals("{ }") == false) { - String substring = result.substring(result.indexOf("["), (result.lastIndexOf("]")+1)); - JSONArray arr = new JSONArray(substring); - if(arr.length() == 0) { - return 1; + + private static int getNumberOfCriticalCPUs() { + String query = "/monitorableproperty?attribute=monitoring.result&value=Critical"; + String result = executor.executeGetOperation(query); + if (result.equals("{ }") == false) { + String substring = result.substring(result.indexOf("["), (result.lastIndexOf("]") + 1)); + JSONArray arr = new JSONArray(substring); + if (arr.length() == 0) { + return 1; + } else { + return arr.length(); + } } else { - return arr.length(); + return 0; } - } else { - return 0; - } -} - -private static int getNumberOfAllCPUs() { - String query = "/monitorableproperty?attribute=monitoring.property&value=CPU"; - String result = executor.executeGetOperation(query); - if(result.equals("{ }") == false) { - String substring = result.substring(result.indexOf("["), (result.lastIndexOf("]")+1)); - JSONArray arr = new JSONArray(substring); - if(arr.length() == 0) { - return 1; + } + + private static int getNumberOfAllCPUs() { + String query = "/monitorableproperty?attribute=monitoring.property&value=CPU"; + String result = executor.executeGetOperation(query); + if (result.equals("{ }") == false) { + String substring = result.substring(result.indexOf("["), (result.lastIndexOf("]") + 1)); + JSONArray arr = new JSONArray(substring); + if (arr.length() == 0) { + return 1; + } else { + return arr.length(); + } } else { - return arr.length(); + return 0; } - } else { - return 0; - } -} + } } \ No newline at end of file diff --git a/src/main/java/de/ugoe/cs/rwm/mocci/Monitor.java b/src/main/java/de/ugoe/cs/rwm/mocci/Monitor.java index 647f15810a62fc73a442d3a6a9e6e8980f0be37c..d33990aa77f472927378f1f3636260067b90b422 100644 --- a/src/main/java/de/ugoe/cs/rwm/mocci/Monitor.java +++ b/src/main/java/de/ugoe/cs/rwm/mocci/Monitor.java @@ -4,17 +4,18 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> */ + package de.ugoe.cs.rwm.mocci; public class Monitor { private int critCPUs; private int noneCPUs; private int allCPUs; - + public int getAllCPUs() { return allCPUs; } @@ -44,6 +45,5 @@ public class Monitor { public void setNoneCPUs(int noneCPUs) { this.noneCPUs = noneCPUs; } - - + } diff --git a/src/main/java/de/ugoe/cs/rwm/mocci/RegistryAndLoggerSetup.java b/src/main/java/de/ugoe/cs/rwm/mocci/RegistryAndLoggerSetup.java index 2bfc9d684a141e50ac9d863a765f3171a2022a15..f4fc1f7b5eedba9d5b5c0ebf5046e53fcc5eef07 100644 --- a/src/main/java/de/ugoe/cs/rwm/mocci/RegistryAndLoggerSetup.java +++ b/src/main/java/de/ugoe/cs/rwm/mocci/RegistryAndLoggerSetup.java @@ -4,28 +4,27 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> */ -package de.ugoe.cs.rwm.mocci; +package de.ugoe.cs.rwm.mocci; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.eclipse.cmf.occi.core.OCCIPackage; -import org.eclipse.cmf.occi.core.util.OCCIResourceFactoryImpl; import org.eclipse.cmf.occi.core.util.OcciRegistry; +import org.eclipse.cmf.occi.crtp.CrtpPackage; import org.eclipse.cmf.occi.infrastructure.InfrastructurePackage; -import org.eclipse.emf.ecore.resource.Resource.Factory.Registry; import org.modmacao.ansibleconfiguration.AnsibleconfigurationPackage; import org.modmacao.occi.platform.PlatformPackage; import org.modmacao.placement.PlacementPackage; + import de.ugoe.cs.rwm.cocci.Comparator; import de.ugoe.cs.rwm.docci.Deployer; import de.ugoe.cs.rwm.docci.appdeployer.MartAppDeployerSlave; import de.ugoe.cs.rwm.docci.connector.Connector; -import de.ugoe.cs.rwm.docci.connector.MartConnector; import de.ugoe.cs.rwm.docci.deprovisioner.Deprovisioner; import de.ugoe.cs.rwm.docci.executor.Executor; import de.ugoe.cs.rwm.docci.provisioner.Provisioner; @@ -35,47 +34,45 @@ import modmacao.ModmacaoPackage; import monitoring.MonitoringPackage; import openstackruntime.OpenstackruntimePackage; import ossweruntime.OssweruntimePackage; -import workflow.WorkflowPackage; public class RegistryAndLoggerSetup { - + static String manNWid = "urn:uuid:29d78078-fb4c-47aa-a9af-b8aaf3339590"; static String manNWRuntimeId = "75a4639e-9ce7-4058-b859-8a711b0e2e7b"; static String sshKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6H7Ydi45BTHid4qNppGAi5mzjbnZgt7bi6xLGmZG9CiLmhMsxOuk3Z05Nn+pmoN98qS0eY8S240PPk5VOlYqBY0vdRAwrZSHHaLdMp6I7ARNrI2KraYduweqz7ZQxPXQfwIeYx2HKQxEF2r+4//Fo4WfgdBkLuulvl/Gw3TUzJNQHvgpaiNo9+PI5CZydHnZbjUkRikS12pT+CbNKj+0QKeQztbCd41aKxDv5H0DjltVRcpPppv4dmiU/zoCAIngWLO1PPgfYWyze8Z9IoyBT7Qdg30U91TYZBuxzXR5lq7Fh64y/IZ/SjdOdSIvIuDjtmJDULRdLJzrvubrKY+YH Generated-by-Nova"; static String userData = "I2Nsb3VkLWNvbmZpZwoKIyBVcGdyYWRlIHRoZSBpbnN0YW5jZSBvbiBmaXJzdCBib290CiMgKGllIHJ1biBhcHQtZ2V0IHVwZ3JhZGUpCiMKIyBEZWZhdWx0OiBmYWxzZQojIEFsaWFzZXM6IGFwdF91cGdyYWRlCnBhY2thZ2VfdXBncmFkZTogdHJ1ZQoKcGFja2FnZXM6CiAtIHB5dGhvbgoKd3JpdGVfZmlsZXM6CiAgLSBwYXRoOiAvZXRjL25ldHdvcmsvaW50ZXJmYWNlcy5kLzUwLWNsb3VkLWluaXQuY2ZnCiAgICBjb250ZW50OiB8CiAgICAgIGF1dG8gbG8KICAgICAgaWZhY2UgbG8gaW5ldCBsb29wYmFjawogICAgICAKICAgICAgYXV0byBlbnMwCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMAogICAgICBpZmFjZSBlbnMwIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMxCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMQogICAgICBpZmFjZSBlbnMxIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMyCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMgogICAgICBpZmFjZSBlbnMyIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMzCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMwogICAgICBpZmFjZSBlbnMzIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM0CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNAogICAgICBpZmFjZSBlbnM0IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM1CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNQogICAgICBpZmFjZSBlbnM1IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM2CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNgogICAgICBpZmFjZSBlbnM2IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM3CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNwogICAgICBpZmFjZSBlbnM3IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM4CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zOAogICAgICBpZmFjZSBlbnM4IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM5CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zOQogICAgICBpZmFjZSBlbnM5IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMxMAogICAgICBhbGxvdy1ob3RwbHVnIGVuczEwCiAgICAgIGlmYWNlIGVuczEwIGluZXQgZGhjcAoKIyMj"; - - + public static void setup() { loggerSetup(); - registrySetup(); - } - + registrySetup(); + } + private static void loggerSetup() { Logger.getLogger(Transformator.class.getName()).setLevel(Level.OFF); Logger.getLogger(Connector.class.getName()).setLevel(Level.OFF); Logger.getLogger(ModelRetriever.class.getName()).setLevel(Level.OFF); Logger.getLogger(Comparator.class.getName()).setLevel(Level.OFF); Logger.getLogger(Provisioner.class.getName()).setLevel(Level.OFF); - Logger.getLogger(Deployer.class.getName()).setLevel(Level.OFF); + Logger.getLogger(Deployer.class.getName()).setLevel(Level.INFO); Logger.getLogger(Deprovisioner.class.getName()).setLevel(Level.OFF); Logger.getLogger(Executor.class.getName()).setLevel(Level.INFO); - Logger.getLogger(MartAppDeployerSlave.class.getName()).setLevel(Level.OFF); + Logger.getLogger(MartAppDeployerSlave.class.getName()).setLevel(Level.INFO); } - + private static void registrySetup() { - + InfrastructurePackage.eINSTANCE.eClass(); OCCIPackage.eINSTANCE.eClass(); ModmacaoPackage.eINSTANCE.eClass(); OpenstackruntimePackage.eINSTANCE.eClass(); - + PlacementPackage.eINSTANCE.eClass(); - WorkflowPackage.eINSTANCE.eClass(); OssweruntimePackage.eINSTANCE.eClass(); AnsibleconfigurationPackage.eINSTANCE.eClass(); MonitoringPackage.eINSTANCE.eClass(); - PlatformPackage.eINSTANCE.eClass(); + CrtpPackage.eINSTANCE.eClass(); + OcciRegistry.getInstance().registerExtension("http://schemas.modmacao.org/occi/platform#", PlatformPackage.class.getClassLoader().getResource("model/platform.occie").toString()); @@ -91,16 +88,17 @@ public class RegistryAndLoggerSetup { InfrastructurePackage.class.getClassLoader().getResource("model/Infrastructure.occie").toString()); OcciRegistry.getInstance().registerExtension("http://schemas.ogf.org/occi/core#", OCCIPackage.class.getClassLoader().getResource("model/Core.occie").toString()); - OcciRegistry.getInstance().registerExtension("http://schemas.ugoe.cs.rwm/workflow#", - OCCIPackage.class.getClassLoader().getResource("model/workflow.occie").toString()); OcciRegistry.getInstance().registerExtension("http://schemas.modmacao.org/openstack/swe#", OCCIPackage.class.getClassLoader().getResource("model/ossweruntime.occie").toString()); OcciRegistry.getInstance().registerExtension("http://schemas.modmacao.org/occi/ansible#", OCCIPackage.class.getClassLoader().getResource("model/ansibleconfiguration.occie").toString()); OcciRegistry.getInstance().registerExtension("http://schemas.ugoe.cs.rwm/monitoring#", MonitoringPackage.class.getClassLoader().getResource("model/monitoring.occie").toString()); - - Registry.INSTANCE.getExtensionToFactoryMap().put("*", new OCCIResourceFactoryImpl()); - + OcciRegistry.getInstance().registerExtension("http://schemas.ogf.org/occi/infrastructure/compute/template/1.1#", + OCCIPackage.class.getClassLoader().getResource("model/crtp.occie").toString()); + + // Registry.INSTANCE.getExtensionToFactoryMap().put("*", new + // OCCIResourceFactoryImpl()); + } } diff --git a/src/main/java/de/ugoe/cs/rwm/mocci/UpScaler.java b/src/main/java/de/ugoe/cs/rwm/mocci/UpScaler.java index cd819d091de072117a4dbde3cbd88d3c0db1a29c..ff915e85b911ad3a2e19324e61bbdff97d3cfbfa 100644 --- a/src/main/java/de/ugoe/cs/rwm/mocci/UpScaler.java +++ b/src/main/java/de/ugoe/cs/rwm/mocci/UpScaler.java @@ -4,10 +4,11 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * - Johannes Erbel <johannes.erbel@cs.uni-goettingen.de> */ + package de.ugoe.cs.rwm.mocci; import java.nio.file.Path; @@ -35,43 +36,44 @@ import monitoring.Resultprovider; import monitoring.Sensor; import ossweruntime.Ubuntu_xenialxerus; -public class UpScaler extends AbsScaler { - +public class UpScaler extends AbsScaler { + public UpScaler(Connector conn, Path runtimePath) { this.conn = conn; this.runtimePath = runtimePath; } - + @SuppressWarnings("unused") public Resource upScaleNodes() { runtimeModel = ModelUtility.loadOCCIintoEMFResource(conn.loadRuntimeModel(runtimePath)); Configuration config = ((Configuration) runtimeModel.getContents().get(0)); - Compute monVM = (Compute) getResourceById(config.getResources(), "urn:uuid:37829092-c690-494a-98fa-335b2fd660ea"); - - Compute comp = addCompute(config); - Component worker = addWorkerComponent(config, comp); - Sensor sens = addSensor(config, comp); - Datagatherer dg = addDataGatherer(config, comp, sens); - Dataprocessor dp = addDataProcessor(config, comp, sens, dg); - Resultprovider rp = addResultProvider(config, comp, sens, dp); - - return runtimeModel; - } - + Compute monVM = (Compute) getResourceById(config.getResources(), + "urn:uuid:37829092-c690-494a-98fa-335b2fd660ea"); + + Compute comp = addCompute(config); + Component worker = addWorkerComponent(config, comp); + Sensor sens = addSensor(config, comp); + Datagatherer dg = addDataGatherer(config, comp, sens); + Dataprocessor dp = addDataProcessor(config, comp, sens, dg); + Resultprovider rp = addResultProvider(config, comp, sens, dp); + + return runtimeModel; + } + private Compute addCompute(Configuration config) { System.out.println(" Adding Compute Node to Model"); Compute comp = iFactory.createCompute(); comp.setOcciComputeState(ComputeStatus.ACTIVE); - + AttributeState state = factory.createAttributeState(); state.setName("occi.compute.state"); state.setValue("active"); comp.getAttributes().add(state); config.getResources().add(comp); - + Ubuntu_xenialxerus mixOs = osFactory.createUbuntu_xenialxerus(); comp.getParts().add(mixOs); - + Networkinterface nwi = iFactory.createNetworkinterface(); nwi.setTarget(getResourceById(config.getResources(), "urn:uuid:29d78078-fb4c-47aa-a9af-b8aaf3339591")); nwi.setSource(comp); @@ -83,47 +85,44 @@ public class UpScaler extends AbsScaler { ipAttr.setName("occi.networkinterface.address"); ipAttr.setValue(ip); nwi.getAttributes().add(ipAttr); - + String ipadjusted = ip.replace(".", "-"); comp.setTitle("hadoop-worker-additional-" + ipadjusted); - + AttributeState hostname = factory.createAttributeState(); hostname.setName("occi.compute.hostname"); hostname.setValue("hadoop-worker-additional-" + ipadjusted); comp.getAttributes().add(hostname); - - + System.out.println(" Ip in Hadoop Network: " + interfaces.get(0)); interfaces.remove(0); - - - + Networkinterface nwimon = iFactory.createNetworkinterface(); nwimon.setTarget(getResourceById(config.getResources(), "urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a")); nwimon.setSource(comp); return comp; } - + private Component addWorkerComponent(Configuration config, Compute comp) { System.out.println(" Adding Worker Component to Model"); Component worker = pFactory.createComponent(); worker.setTitle("worker-component"); - //worker.setOcciComponentState(Status.ACTIVE); + // worker.setOcciComponentState(Status.ACTIVE); config.getResources().add(worker); - + AttributeState attr = factory.createAttributeState(); attr.setName("occi.core.id"); attr.setValue(worker.getId()); worker.getAttributes().add(attr); - + MixinBase mBase = factory.createMixinBase(); mBase.setMixin(getMixin("hworker", config)); worker.getParts().add(mBase); - + Placementlink pLink = placeFactory.createPlacementlink(); pLink.setSource(worker); pLink.setTarget(comp); - + Componentlink compLink = pFactory.createComponentlink(); compLink.setSource(getResourceById(config.getResources(), "urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d")); compLink.setTarget(worker); @@ -136,12 +135,12 @@ public class UpScaler extends AbsScaler { Sensor sens = mFactory.createSensor(); sens.setTitle("CPUSensor"); config.getResources().add(sens); - + AttributeState attr = factory.createAttributeState(); attr.setName("occi.core.id"); attr.setValue(sens.getId()); sens.getAttributes().add(attr); - + Monitorableproperty mp = mFactory.createMonitorableproperty(); mp.setTitle("monProp"); mp.setMonitoringProperty("CPU"); @@ -151,33 +150,33 @@ public class UpScaler extends AbsScaler { mp.getAttributes().add(attrProp); mp.setSource(sens); mp.setTarget(comp); - + return sens; } - + private Datagatherer addDataGatherer(Configuration config, Compute comp, Sensor sens) { System.out.println(" Adding Datagatherer to Model"); Datagatherer dg = mFactory.createDatagatherer(); dg.setTitle("CPUGatherer"); config.getResources().add(dg); - + AttributeState attr = factory.createAttributeState(); attr.setName("occi.core.id"); attr.setValue(dg.getId()); dg.getAttributes().add(attr); - + MixinBase mBase = factory.createMixinBase(); mBase.setMixin(getMixin("cpugatherer", config)); dg.getParts().add(mBase); - + Componentlink c1 = pFactory.createComponentlink(); c1.setSource(sens); c1.setTarget(dg); - + Placementlink pl = placeFactory.createPlacementlink(); pl.setSource(dg); pl.setTarget(comp); - + return dg; } @@ -186,16 +185,16 @@ public class UpScaler extends AbsScaler { Dataprocessor dp = mFactory.createDataprocessor(); dp.setTitle("CPUProcessor"); config.getResources().add(dp); - + AttributeState attr = factory.createAttributeState(); attr.setName("occi.core.id"); attr.setValue(dp.getId()); dp.getAttributes().add(attr); - + MixinBase mBase = factory.createMixinBase(); mBase.setMixin(getMixin("cpuprocessorlocal", config)); dp.getParts().add(mBase); - + Componentlink c2 = pFactory.createComponentlink(); c2.setSource(sens); c2.setTarget(dp); @@ -213,43 +212,43 @@ public class UpScaler extends AbsScaler { Resultprovider rp = mFactory.createResultprovider(); rp.setTitle("CPUProvider"); config.getResources().add(rp); - + Occiresultprovider orp = mFactory.createOcciresultprovider(); orp.setResultProviderEndpoint("192.168.35.45:8080"); AttributeState attrOP = factory.createAttributeState(); attrOP.setName("result.provider.endpoint"); attrOP.setValue("192.168.35.45:8080"); rp.getAttributes().add(attrOP); - + rp.getParts().add(orp); - + MixinBase mBase = factory.createMixinBase(); mBase.setMixin(getMixin("cpupublisher", config)); rp.getParts().add(mBase); - + AttributeState attr = factory.createAttributeState(); attr.setName("occi.core.id"); attr.setValue(rp.getId()); rp.getAttributes().add(attr); - + Componentlink c3 = pFactory.createComponentlink(); c3.setSource(sens); c3.setTarget(rp); - + Placementlink pl = placeFactory.createPlacementlink(); pl.setSource(rp); pl.setTarget(comp); - + Componentlink cl = pFactory.createComponentlink(); cl.setSource(rp); cl.setTarget(dp); - + return rp; } - + private Mixin getMixin(String string, Configuration config) { - for(Mixin mix: config.getMixins()) { - if(mix.getTerm().equals(string)) { + for (Mixin mix : config.getMixins()) { + if (mix.getTerm().equals(string)) { return mix; } } diff --git a/src/main/java/de/ugoe/cs/rwm/mocci/package-info.java b/src/main/java/de/ugoe/cs/rwm/mocci/package-info.java index 2bfc2dbd8043e3ba777821b400a8bb26d36a0bc0..9e91f34adb2f8e450569c3ad09f5467494c24da4 100644 --- a/src/main/java/de/ugoe/cs/rwm/mocci/package-info.java +++ b/src/main/java/de/ugoe/cs/rwm/mocci/package-info.java @@ -1,6 +1,3 @@ -/** - * - */ /** * Main package that includes util classes as well as the monitoring interface. * diff --git a/src/main/resources/de/ugoe/cs/rwm/mocci/occi/hadoopClusterCPU.occic b/src/main/resources/de/ugoe/cs/rwm/mocci/occi/hadoopClusterCPU.occic index 64b7410ed9fa51fbe002e808439a26049b8f5d53..9974f732279f7342b26da33e4c76053c890137ef 100644 --- a/src/main/resources/de/ugoe/cs/rwm/mocci/occi/hadoopClusterCPU.occic +++ b/src/main/resources/de/ugoe/cs/rwm/mocci/occi/hadoopClusterCPU.occic @@ -73,7 +73,7 @@ <attributes name="occi.core.target" value="/compute/urn:uuid:2e6a73d0-faaa-476a-bd25-ca461dd166ce/"/> </links> </resources> - <resources xsi:type="platform:Application" id="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" title="Hadoopcluster" location="/application/urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" occiAppName="" occiAppState="deployed"> + <resources xsi:type="platform:Application" id="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" title="Hadoopcluster" location="/application/urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" occiAppName="" occiAppState="undeployed"> <kind href="http://schemas.modmacao.org/occi/platform#//@kinds[term='application']"/> <attributes name="occi.core.id" value="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d"/> <attributes name="occi.core.title" value="Hadoopcluster"/> @@ -236,7 +236,7 @@ <attributes name="occi.core.title" value="link2"/> </links> </resources> - <resources xsi:type="infrastructure:Compute" id="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea" title="MonVm" rlinks="//@resources.9/@links.1 //@resources.10/@links.1" occiComputeHostname="monVM"> + <resources xsi:type="infrastructure:Compute" id="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea" title="MonVm" rlinks="//@resources.9/@links.1 //@resources.10/@links.1" occiComputeState="active" occiComputeHostname="monVM"> <kind href="http://schemas.ogf.org/occi/infrastructure#//@kinds[term='compute']"/> <attributes name="occi.core.id" value="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea"/> <attributes name="occi.core.title" value="MonVm"/> @@ -261,7 +261,7 @@ </parts> </links> </resources> - <resources xsi:type="infrastructure:Network" id="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a" title="MonitoringNetwork" rlinks="//@resources.11/@links.0 //@resources.4/@links.1"> + <resources xsi:type="infrastructure:Network" id="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a" title="MonitoringNetwork" occiNetworkState="active" rlinks="//@resources.11/@links.0 //@resources.4/@links.1"> <kind href="http://schemas.ogf.org/occi/infrastructure#//@kinds[term='network']"/> <attributes name="occi.core.id" value="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a"/> <attributes name="occi.core.title" value="MonitoringNetwork"/> diff --git a/src/main/resources/de/ugoe/cs/rwm/mocci/occi/hadoopClusterNewExtWithMem.occic b/src/main/resources/de/ugoe/cs/rwm/mocci/occi/hadoopClusterNewExtWithMem.occic index 468d6456b9697e3ffe0d8a4e243950dd87bc1ad2..a98c32ef23d69b873379bd0d0f16f77ac2fd9f86 100644 --- a/src/main/resources/de/ugoe/cs/rwm/mocci/occi/hadoopClusterNewExtWithMem.occic +++ b/src/main/resources/de/ugoe/cs/rwm/mocci/occi/hadoopClusterNewExtWithMem.occic @@ -73,7 +73,7 @@ <attributes name="occi.core.target" value="/compute/urn:uuid:2e6a73d0-faaa-476a-bd25-ca461dd166ce/"/> </links> </resources> - <resources xsi:type="platform:Application" id="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" title="Hadoopcluster" location="/application/urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" occiAppName="" occiAppState="deployed"> + <resources xsi:type="platform:Application" id="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" title="Hadoopcluster" location="/application/urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" occiAppName="" occiAppState="undeployed"> <kind href="http://schemas.modmacao.org/occi/platform#//@kinds[term='application']"/> <attributes name="occi.core.id" value="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d"/> <attributes name="occi.core.title" value="hadoopcluster"/> @@ -236,7 +236,7 @@ <attributes name="occi.core.title" value="link2"/> </links> </resources> - <resources xsi:type="infrastructure:Compute" id="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea" title="MonVm" rlinks="//@resources.9/@links.1 //@resources.10/@links.1 //@resources.13/@links.1 //@resources.14/@links.1" occiComputeHostname="monVM" occiComputeState="inactive"> + <resources xsi:type="infrastructure:Compute" id="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea" title="MonVm" rlinks="//@resources.9/@links.1 //@resources.10/@links.1 //@resources.13/@links.1 //@resources.14/@links.1" occiComputeHostname="monVM" occiComputeState="active"> <kind href="http://schemas.ogf.org/occi/infrastructure#//@kinds[term='compute']"/> <attributes name="occi.core.id" value="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea"/> <attributes name="occi.core.title" value="MonVm"/> @@ -261,7 +261,7 @@ </parts> </links> </resources> - <resources xsi:type="infrastructure:Network" id="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a" title="MonitoringNetwork" rlinks="//@resources.11/@links.0 //@resources.4/@links.1" occiNetworkState="inactive"> + <resources xsi:type="infrastructure:Network" id="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a" title="MonitoringNetwork" rlinks="//@resources.11/@links.0 //@resources.4/@links.1" occiNetworkState="active"> <kind href="http://schemas.ogf.org/occi/infrastructure#//@kinds[term='network']"/> <attributes name="occi.core.id" value="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a"/> <attributes name="occi.core.title" value="MonitoringNetwork"/> diff --git a/src/test/java/de/ugoe/cs/rwm/mocci/CreateMonitoringElementsTest.java b/src/test/java/de/ugoe/cs/rwm/mocci/CreateMonitoringElementsTest.java index 600aac1024876c7bab18f9eecf969b546185917d..abfc896655b4a6197f6e3d6ad8bba3b33306b63a 100644 --- a/src/test/java/de/ugoe/cs/rwm/mocci/CreateMonitoringElementsTest.java +++ b/src/test/java/de/ugoe/cs/rwm/mocci/CreateMonitoringElementsTest.java @@ -2,108 +2,81 @@ package de.ugoe.cs.rwm.mocci; import static org.junit.Assert.assertTrue; -import java.nio.file.Path; -import java.nio.file.Paths; - -import org.apache.log4j.Level; -import org.apache.log4j.Logger; import org.eclipse.cmf.occi.core.Configuration; import org.eclipse.cmf.occi.core.Link; -import org.eclipse.cmf.occi.core.Mixin; -import org.eclipse.cmf.occi.core.MixinBase; import org.eclipse.cmf.occi.core.OCCIFactory; -import org.eclipse.cmf.occi.core.OCCIPackage; import org.eclipse.cmf.occi.core.impl.OCCIFactoryImpl; -import org.eclipse.cmf.occi.core.util.OcciRegistry; import org.eclipse.cmf.occi.infrastructure.Compute; import org.eclipse.cmf.occi.infrastructure.InfrastructureFactory; import org.eclipse.cmf.occi.infrastructure.impl.InfrastructureFactoryImpl; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.epsilon.emc.emf.CachedResourceSet; -import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.modmacao.occi.platform.Componentlink; import org.modmacao.occi.platform.PlatformFactory; import org.modmacao.occi.platform.impl.PlatformFactoryImpl; -import de.ugoe.cs.rwm.docci.MartDeployer; -import de.ugoe.cs.rwm.docci.ModelUtility; -import de.ugoe.cs.rwm.mocci.TestUtility; -import de.ugoe.cs.rwm.docci.connector.Connector; -import de.ugoe.cs.rwm.docci.connector.LocalhostConnector; -import de.ugoe.cs.rwm.tocci.Transformator; -import de.ugoe.cs.rwm.tocci.TransformatorFactory; -import de.ugoe.cs.rwm.tocci.occi2openstack.OCCI2OPENSTACKTransformator; import monitoring.Datagatherer; import monitoring.Dataprocessor; import monitoring.Monitorableproperty; import monitoring.MonitoringFactory; -import monitoring.MonitoringPackage; import monitoring.Resultprovider; import monitoring.Sensor; import monitoring.impl.MonitoringFactoryImpl; public class CreateMonitoringElementsTest { - + @BeforeClass - public static void OCCIRegistrySetup() { + public static void OCCIRegistrySetup() { TestUtility.loggerSetup(); TestUtility.extensionRegistrySetup(); } - + @Test public void createMonitoringElements() { - //Factories to create OCCI elements + // Factories to create OCCI elements OCCIFactory cFact = new OCCIFactoryImpl(); InfrastructureFactory iFact = new InfrastructureFactoryImpl(); MonitoringFactory mFact = new MonitoringFactoryImpl(); PlatformFactory pFact = new PlatformFactoryImpl(); - - //Top level element + + // Top level element Configuration config = cFact.createConfiguration(); Compute comp = iFact.createCompute(); - //Resources + // Resources Sensor sensor = mFact.createSensor(); config.getResources().add(sensor); config.getResources().add(comp); - + Monitorableproperty mp = mFact.createMonitorableproperty(); mp.setSource(sensor); mp.setTarget(comp); - + Datagatherer dg = mFact.createDatagatherer(); Componentlink cl = pFact.createComponentlink(); cl.setSource(sensor); cl.setTarget(dg); - + Dataprocessor dp = mFact.createDataprocessor(); Componentlink cl1 = pFact.createComponentlink(); cl1.setSource(sensor); cl1.setTarget(dp); - + Resultprovider rp = mFact.createResultprovider(); Componentlink cl2 = pFact.createComponentlink(); cl2.setSource(sensor); cl2.setTarget(rp); - + System.out.println("Checking configuration: " + config.getResources()); - + assertTrue(checkSensor(config)); - + } - public boolean checkSensor(Configuration conf) { - for(org.eclipse.cmf.occi.core.Resource res: conf.getResources()) { - if(res instanceof Sensor) { + for (org.eclipse.cmf.occi.core.Resource res : conf.getResources()) { + if (res instanceof Sensor) { Sensor sens = (Sensor) res; - if(containsDevices(sens)) { + if (containsDevices(sens)) { return true; } } @@ -113,15 +86,14 @@ public class CreateMonitoringElementsTest { private boolean containsDevices(Sensor sens) { int count = 0; - for(Link link: sens.getLinks()) { - if(link instanceof Componentlink) { + for (Link link : sens.getLinks()) { + if (link instanceof Componentlink) { count++; } } - if(count == 3) { + if (count == 3) { return true; } return false; } } - \ No newline at end of file diff --git a/src/test/java/de/ugoe/cs/rwm/mocci/DeployHadoopMonitoringTest.java b/src/test/java/de/ugoe/cs/rwm/mocci/DeployHadoopMonitoringTest.java index 9cdb034ec3c2a56df84414fcc04d8829cb8448b9..f634c77c329bf56241cede8ba3c3e2b65e340c74 100644 --- a/src/test/java/de/ugoe/cs/rwm/mocci/DeployHadoopMonitoringTest.java +++ b/src/test/java/de/ugoe/cs/rwm/mocci/DeployHadoopMonitoringTest.java @@ -8,13 +8,13 @@ import java.nio.file.Paths; import org.eclipse.cmf.occi.core.util.OcciRegistry; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.epsilon.emc.emf.CachedResourceSet; +import org.eclipse.epsilon.eol.exceptions.EolRuntimeException; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import de.ugoe.cs.rwm.docci.MartDeployer; import de.ugoe.cs.rwm.docci.ModelUtility; -import de.ugoe.cs.rwm.mocci.TestUtility; import de.ugoe.cs.rwm.docci.connector.Connector; import de.ugoe.cs.rwm.docci.connector.LocalhostConnector; import de.ugoe.cs.rwm.tocci.Transformator; @@ -26,9 +26,9 @@ public class DeployHadoopMonitoringTest { private static String manNWRuntimeId = "75a4639e-9ce7-4058-b859-8a711b0e2e7b"; private static String sshKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6H7Ydi45BTHid4qNppGAi5mzjbnZgt7bi6xLGmZG9CiLmhMsxOuk3Z05Nn+pmoN98qS0eY8S240PPk5VOlYqBY0vdRAwrZSHHaLdMp6I7ARNrI2KraYduweqz7ZQxPXQfwIeYx2HKQxEF2r+4//Fo4WfgdBkLuulvl/Gw3TUzJNQHvgpaiNo9+PI5CZydHnZbjUkRikS12pT+CbNKj+0QKeQztbCd41aKxDv5H0DjltVRcpPppv4dmiU/zoCAIngWLO1PPgfYWyze8Z9IoyBT7Qdg30U91TYZBuxzXR5lq7Fh64y/IZ/SjdOdSIvIuDjtmJDULRdLJzrvubrKY+YH Generated-by-Nova"; private static String userData = "I2Nsb3VkLWNvbmZpZwoKIyBVcGdyYWRlIHRoZSBpbnN0YW5jZSBvbiBmaXJzdCBib290CiMgKGllIHJ1biBhcHQtZ2V0IHVwZ3JhZGUpCiMKIyBEZWZhdWx0OiBmYWxzZQojIEFsaWFzZXM6IGFwdF91cGdyYWRlCnBhY2thZ2VfdXBncmFkZTogdHJ1ZQoKcGFja2FnZXM6CiAtIHB5dGhvbgoKd3JpdGVfZmlsZXM6CiAgLSBwYXRoOiAvZXRjL25ldHdvcmsvaW50ZXJmYWNlcy5kLzUwLWNsb3VkLWluaXQuY2ZnCiAgICBjb250ZW50OiB8CiAgICAgIGF1dG8gbG8KICAgICAgaWZhY2UgbG8gaW5ldCBsb29wYmFjawogICAgICAKICAgICAgYXV0byBlbnMwCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMAogICAgICBpZmFjZSBlbnMwIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMxCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMQogICAgICBpZmFjZSBlbnMxIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMyCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMgogICAgICBpZmFjZSBlbnMyIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMzCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMwogICAgICBpZmFjZSBlbnMzIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM0CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNAogICAgICBpZmFjZSBlbnM0IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM1CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNQogICAgICBpZmFjZSBlbnM1IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM2CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNgogICAgICBpZmFjZSBlbnM2IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM3CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNwogICAgICBpZmFjZSBlbnM3IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM4CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zOAogICAgICBpZmFjZSBlbnM4IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM5CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zOQogICAgICBpZmFjZSBlbnM5IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMxMAogICAgICBhbGxvdy1ob3RwbHVnIGVuczEwCiAgICAgIGlmYWNlIGVuczEwIGluZXQgZGhjcAoKIyMj"; - + @BeforeClass - public static void OCCIRegistrySetup() { + public static void OCCIRegistrySetup() { TestUtility.loggerSetup(); TestUtility.extensionRegistrySetup(); } @@ -49,30 +49,38 @@ public class DeployHadoopMonitoringTest { Path occiPath = Paths.get(ModelUtility.getPathToResource("occi/hadoopClusterCPU.occic")); Resource model = ModelUtility.loadOCCIintoEMFResource(occiPath); - - + Transformator trans = TransformatorFactory.getTransformator("OCCI2OCCI"); - trans.transform(model, occiPath); + try { + trans.transform(model, occiPath); + } catch (EolRuntimeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } model = ModelUtility.loadOCCIintoEMFResource(occiPath); - - OCCI2OPENSTACKTransformator trans2 = OCCI2OPENSTACKTransformator.getInstance(); + + OCCI2OPENSTACKTransformator trans2 = new OCCI2OPENSTACKTransformator(); trans2.setTransformationProperties(manNWRuntimeId, sshKey, userData, manNWid); - - trans2.transform(model, occiPath); - + + try { + trans2.transform(model, occiPath); + } catch (EolRuntimeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + model = ModelUtility.loadOCCIintoEMFResource(occiPath); - Connector conn = new LocalhostConnector("localhost", 8080, "ubuntu"); MartDeployer deployer = new MartDeployer(conn); deployer.deploy(model); - + assertTrue(TestUtility.equalsRuntime(model, conn)); } - + @Test public void deployHadoopWithCPUAndMemMonitoring() { CachedResourceSet.getCache().clear(); @@ -80,26 +88,34 @@ public class DeployHadoopMonitoringTest { Path occiPath = Paths.get(ModelUtility.getPathToResource("occi/hadoopClusterNewExtWithMem.occic")); Resource model = ModelUtility.loadOCCIintoEMFResource(occiPath); - - + Transformator trans = TransformatorFactory.getTransformator("OCCI2OCCI"); - trans.transform(model, occiPath); + try { + trans.transform(model, occiPath); + } catch (EolRuntimeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } model = ModelUtility.loadOCCIintoEMFResource(occiPath); - - OCCI2OPENSTACKTransformator trans2 = OCCI2OPENSTACKTransformator.getInstance(); + + OCCI2OPENSTACKTransformator trans2 = new OCCI2OPENSTACKTransformator(); trans2.setTransformationProperties(manNWRuntimeId, sshKey, userData, manNWid); - - trans2.transform(model, occiPath); - + + try { + trans2.transform(model, occiPath); + } catch (EolRuntimeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + model = ModelUtility.loadOCCIintoEMFResource(occiPath); - Connector conn = new LocalhostConnector("localhost", 8080, "ubuntu"); MartDeployer deployer = new MartDeployer(conn); deployer.deploy(model); - + assertTrue(TestUtility.equalsRuntime(model, conn)); } diff --git a/src/test/java/de/ugoe/cs/rwm/mocci/MapeTest.java b/src/test/java/de/ugoe/cs/rwm/mocci/MapeTest.java index 1b6dc891ac4a74ce685e2ecfd68be8c702b71653..72bba2b93f1340ad74d3b6c025338dfd5657b518 100644 --- a/src/test/java/de/ugoe/cs/rwm/mocci/MapeTest.java +++ b/src/test/java/de/ugoe/cs/rwm/mocci/MapeTest.java @@ -10,7 +10,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.epsilon.emc.emf.CachedResourceSet; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import de.ugoe.cs.rwm.docci.MartDeployer; @@ -18,16 +17,14 @@ import de.ugoe.cs.rwm.docci.ModelUtility; import de.ugoe.cs.rwm.docci.connector.Connector; import de.ugoe.cs.rwm.docci.connector.LocalhostConnector; - public class MapeTest { - @BeforeClass - public static void OCCIRegistrySetup() { + public static void OCCIRegistrySetup() { TestUtility.loggerSetup(); - TestUtility.extensionRegistrySetup(); + TestUtility.extensionRegistrySetup(); } - + @Before public void resetEverything() { CachedResourceSet.getCache().clear(); @@ -35,41 +32,41 @@ public class MapeTest { Connector conn = new LocalhostConnector("localhost", 8080, "ubuntu"); MartDeployer deployer = new MartDeployer(conn); deployer.deploy(occiPath); - + InitialDeployment.main(new String[0]); } - + @Test public void Monitor() { - Monitor monitor = MAPE.monitor(); - assertTrue(monitor.getAllCPUs() == 1); - } - + Monitor monitor = MAPE.monitor(); + assertTrue(monitor.getAllCPUs() == 1); + } + @Test public void Analyze() { Monitor monitor = MAPE.monitor(); String analysis = MAPE.analyze(monitor); - if(monitor.getCritCPUs() == 1) { + if (monitor.getCritCPUs() == 1) { assertTrue(analysis.equals("upScale")); } - if(monitor.getNoneCPUs() == 1) { + if (monitor.getNoneCPUs() == 1) { assertTrue(analysis.equals("downScale")); } } - + @Test public void Plan() { Monitor monitor = MAPE.monitor(); String analysis = MAPE.analyze(monitor); Resource res = MAPE.plan(analysis); - if(analysis.equals("upScale")) { + if (analysis.equals("upScale")) { Configuration pre = (Configuration) MAPE.runtimeModel.getContents().get(0); Configuration post = (Configuration) res.getContents().get(0); - assertTrue(pre.getResources().size()<post.getResources().size()); - - } + assertTrue(pre.getResources().size() < post.getResources().size()); + } - + } + @Test public void Execute() { Monitor monitor = MAPE.monitor(); @@ -78,7 +75,28 @@ public class MapeTest { MAPE.execute(MAPE.runtimeModel); assertTrue(TestUtility.equalsRuntime(MAPE.runtimeModel, MAPE.conn)); } - -} - \ No newline at end of file + @Test + public void Iterations() { + int iterations = 20; + int count = 0; + int interval = 1000; + while (count < iterations) { + try { + System.out.println("\n--------------------Waiting for new MAPE-K Cycle: Sleeping " + interval + + "--------------------"); + Thread.sleep(interval); + + Monitor monitor = MAPE.monitor(); + String analysis = MAPE.analyze(monitor); + MAPE.runtimeModel = MAPE.plan(analysis); + MAPE.execute(MAPE.runtimeModel); + count++; + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + } + +} diff --git a/src/test/java/de/ugoe/cs/rwm/mocci/ResolveProxyTest.java b/src/test/java/de/ugoe/cs/rwm/mocci/ResolveProxyTest.java index 5445e4dcb9d2d5278b07314a6a57e29116c481e5..d56110af1178e1b8963096e194ce8493cf9d8251 100644 --- a/src/test/java/de/ugoe/cs/rwm/mocci/ResolveProxyTest.java +++ b/src/test/java/de/ugoe/cs/rwm/mocci/ResolveProxyTest.java @@ -5,54 +5,34 @@ import static org.junit.Assert.assertTrue; import java.nio.file.Path; import java.nio.file.Paths; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.eclipse.cmf.occi.core.Configuration; import org.eclipse.cmf.occi.core.Link; import org.eclipse.cmf.occi.core.Mixin; -import org.eclipse.cmf.occi.core.OCCIPackage; -import org.eclipse.cmf.occi.core.util.OcciRegistry; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.epsilon.emc.emf.CachedResourceSet; -import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; -import org.modmacao.occi.platform.Componentlink; -import org.modmacao.occi.platform.impl.PlatformFactoryImpl; - -import de.ugoe.cs.rwm.docci.MartDeployer; -import de.ugoe.cs.rwm.docci.ModelUtility; -import de.ugoe.cs.rwm.mocci.TestUtility; -import de.ugoe.cs.rwm.docci.connector.Connector; -import de.ugoe.cs.rwm.docci.connector.LocalhostConnector; -import de.ugoe.cs.rwm.tocci.Transformator; -import de.ugoe.cs.rwm.tocci.TransformatorFactory; -import de.ugoe.cs.rwm.tocci.occi2openstack.OCCI2OPENSTACKTransformator; -import monitoring.MonitoringPackage; public class ResolveProxyTest { - + @BeforeClass - public static void OCCIRegistrySetup() { + public static void OCCIRegistrySetup() { TestUtility.loggerSetup(); TestUtility.extensionRegistrySetup(); } @Test public void resolveProxies() { - Path newOCCI = Paths.get(de.ugoe.cs.rwm.docci.ModelUtility.getPathToResource("occi/hadoopClusterNewExtWithMem.occic")); - + Path newOCCI = Paths + .get(de.ugoe.cs.rwm.docci.ModelUtility.getPathToResource("occi/hadoopClusterNewExtWithMem.occic")); + Resource ress = de.ugoe.cs.rwm.docci.ModelUtility.loadOCCIintoEMFResource(newOCCI); + @SuppressWarnings("unused") ResourceSet resSet = ress.getResourceSet(); - - + EList<EObject> newModel = de.ugoe.cs.rwm.docci.ModelUtility.loadOCCI(newOCCI); - + for (org.eclipse.cmf.occi.core.Resource res : de.ugoe.cs.rwm.docci.ModelUtility.getResources(newModel)) { System.out.println("Resource Title: " + res.getTitle()); System.out.println(" Kind: " + res.getKind()); diff --git a/src/test/java/de/ugoe/cs/rwm/mocci/TestUtility.java b/src/test/java/de/ugoe/cs/rwm/mocci/TestUtility.java index d1cc07030e1c6132129b003fe2bb1666c2ba8062..1bcc20ef029eb462e9c51625844278a38c4d4d09 100644 --- a/src/test/java/de/ugoe/cs/rwm/mocci/TestUtility.java +++ b/src/test/java/de/ugoe/cs/rwm/mocci/TestUtility.java @@ -1,42 +1,32 @@ package de.ugoe.cs.rwm.mocci; import java.io.File; -import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Map; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import org.eclipse.cmf.occi.core.OCCIPackage; import org.eclipse.cmf.occi.core.util.OcciRegistry; +import org.eclipse.cmf.occi.crtp.CrtpPackage; import org.eclipse.cmf.occi.infrastructure.InfrastructurePackage; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; import org.modmacao.ansibleconfiguration.AnsibleconfigurationPackage; import org.modmacao.occi.platform.PlatformPackage; -import org.modmacao.occi.platform.impl.PlatformFactoryImpl; import org.modmacao.placement.PlacementPackage; import de.ugoe.cs.rwm.cocci.Comparator; import de.ugoe.cs.rwm.cocci.ComparatorFactory; import de.ugoe.cs.rwm.docci.Deployer; import de.ugoe.cs.rwm.docci.ModelUtility; -import de.ugoe.cs.rwm.docci.appdeployer.MartAppDeployerMaster; -import de.ugoe.cs.rwm.docci.appdeployer.MartAppDeployerSlave; import de.ugoe.cs.rwm.docci.connector.Connector; -import de.ugoe.cs.rwm.docci.deprovisioner.Deprovisioner; import de.ugoe.cs.rwm.docci.executor.Executor; -import de.ugoe.cs.rwm.docci.extractor.Extractor; -import de.ugoe.cs.rwm.docci.provisioner.Provisioner; -import de.ugoe.cs.rwm.tocci.Transformator; import modmacao.ModmacaoPackage; import monitoring.MonitoringPackage; import openstackruntime.OpenstackruntimePackage; import ossweruntime.OssweruntimePackage; -import workflow.WorkflowPackage; public class TestUtility { public static void extensionRegistrySetup() { @@ -44,14 +34,14 @@ public class TestUtility { OCCIPackage.eINSTANCE.eClass(); ModmacaoPackage.eINSTANCE.eClass(); OpenstackruntimePackage.eINSTANCE.eClass(); - + PlacementPackage.eINSTANCE.eClass(); - WorkflowPackage.eINSTANCE.eClass(); OssweruntimePackage.eINSTANCE.eClass(); AnsibleconfigurationPackage.eINSTANCE.eClass(); MonitoringPackage.eINSTANCE.eClass(); - + CrtpPackage.eINSTANCE.eClass(); PlatformPackage.eINSTANCE.eClass(); + OcciRegistry.getInstance().registerExtension("http://schemas.modmacao.org/occi/platform#", PlatformPackage.class.getClassLoader().getResource("model/platform.occie").toString()); @@ -67,32 +57,31 @@ public class TestUtility { InfrastructurePackage.class.getClassLoader().getResource("model/Infrastructure.occie").toString()); OcciRegistry.getInstance().registerExtension("http://schemas.ogf.org/occi/core#", OCCIPackage.class.getClassLoader().getResource("model/Core.occie").toString()); - OcciRegistry.getInstance().registerExtension("http://schemas.ugoe.cs.rwm/workflow#", - OCCIPackage.class.getClassLoader().getResource("model/workflow.occie").toString()); OcciRegistry.getInstance().registerExtension("http://schemas.modmacao.org/openstack/swe#", OCCIPackage.class.getClassLoader().getResource("model/ossweruntime.occie").toString()); OcciRegistry.getInstance().registerExtension("http://schemas.modmacao.org/occi/ansible#", OCCIPackage.class.getClassLoader().getResource("model/ansibleconfiguration.occie").toString()); OcciRegistry.getInstance().registerExtension("http://schemas.ugoe.cs.rwm/monitoring#", MonitoringPackage.class.getClassLoader().getResource("model/monitoring.occie").toString()); + OcciRegistry.getInstance().registerExtension("http://schemas.ogf.org/occi/infrastructure/compute/template/1.1#", + OCCIPackage.class.getClassLoader().getResource("model/crtp.occie").toString()); - - } + } public static void loggerSetup() { File log4jfile = new File(ModelUtility.getPathToResource("log4j.properties")); PropertyConfigurator.configure(log4jfile.getAbsolutePath()); Logger.getLogger(Executor.class.getName()).setLevel(Level.DEBUG); - //Logger.getLogger(Extractor.class.getName()).setLevel(Level.DEBUG); - //Logger.getLogger(Provisioner.class.getName()).setLevel(Level.DEBUG); - Logger.getLogger(Comparator.class.getName()).setLevel(Level.DEBUG); - Logger.getLogger(Deprovisioner.class.getName()).setLevel(Level.INFO); - //Logger.getLogger(Connector.class.getName()).setLevel(Level.DEBUG); - //Logger.getLogger(ElementAdapter.class.getName()).setLevel(Level.INFO); + // Logger.getLogger(Extractor.class.getName()).setLevel(Level.DEBUG); + // Logger.getLogger(Provisioner.class.getName()).setLevel(Level.DEBUG); + // Logger.getLogger(Comparator.class.getName()).setLevel(Level.DEBUG); + // Logger.getLogger(Deprovisioner.class.getName()).setLevel(Level.INFO); + // Logger.getLogger(Connector.class.getName()).setLevel(Level.DEBUG); + // Logger.getLogger(ElementAdapter.class.getName()).setLevel(Level.INFO); Logger.getLogger(Deployer.class.getName()).setLevel(Level.INFO); - Logger.getLogger(MartAppDeployerMaster.class.getName()).setLevel(Level.DEBUG); - Logger.getLogger(MartAppDeployerSlave.class.getName()).setLevel(Level.DEBUG); - //Logger.getLogger(Transformator.class.getName()).setLevel(Level.DEBUG); + // Logger.getLogger(MartAppDeployerMaster.class.getName()).setLevel(Level.DEBUG); + // Logger.getLogger(MartAppDeployerSlave.class.getName()).setLevel(Level.DEBUG); + // Logger.getLogger(Transformator.class.getName()).setLevel(Level.DEBUG); } public static boolean equalsRuntime(Path desiredModelPath, Connector conn) { @@ -125,8 +114,7 @@ public class TestUtility { } return assertion; } - - + public static boolean equalsRuntime(Resource desiredModel, Connector conn) { Path deployedOCCI = Paths.get(System.getProperty("user.home") + "/.rwm/runtime.occic"); conn.loadRuntimeModel(deployedOCCI); diff --git a/src/test/java/de/ugoe/cs/rwm/mocci/live/DeployHadoopMonitoringTestLive.java b/src/test/java/de/ugoe/cs/rwm/mocci/live/DeployHadoopMonitoringTestLive.java index 4ca86bcc7579c43fd056a4ad79ad24adda1fef6b..6a986092d6d44670bed19d5fda9c62f992585ee2 100644 --- a/src/test/java/de/ugoe/cs/rwm/mocci/live/DeployHadoopMonitoringTestLive.java +++ b/src/test/java/de/ugoe/cs/rwm/mocci/live/DeployHadoopMonitoringTestLive.java @@ -6,6 +6,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import org.eclipse.epsilon.emc.emf.CachedResourceSet; +import org.eclipse.epsilon.eol.exceptions.EolRuntimeException; import org.junit.BeforeClass; import org.junit.Test; @@ -24,13 +25,12 @@ public class DeployHadoopMonitoringTestLive { String sshKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6H7Ydi45BTHid4qNppGAi5mzjbnZgt7bi6xLGmZG9CiLmhMsxOuk3Z05Nn+pmoN98qS0eY8S240PPk5VOlYqBY0vdRAwrZSHHaLdMp6I7ARNrI2KraYduweqz7ZQxPXQfwIeYx2HKQxEF2r+4//Fo4WfgdBkLuulvl/Gw3TUzJNQHvgpaiNo9+PI5CZydHnZbjUkRikS12pT+CbNKj+0QKeQztbCd41aKxDv5H0DjltVRcpPppv4dmiU/zoCAIngWLO1PPgfYWyze8Z9IoyBT7Qdg30U91TYZBuxzXR5lq7Fh64y/IZ/SjdOdSIvIuDjtmJDULRdLJzrvubrKY+YH Generated-by-Nova"; String userData = "I2Nsb3VkLWNvbmZpZwoKIyBVcGdyYWRlIHRoZSBpbnN0YW5jZSBvbiBmaXJzdCBib290CiMgKGllIHJ1biBhcHQtZ2V0IHVwZ3JhZGUpCiMKIyBEZWZhdWx0OiBmYWxzZQojIEFsaWFzZXM6IGFwdF91cGdyYWRlCnBhY2thZ2VfdXBncmFkZTogdHJ1ZQoKcGFja2FnZXM6CiAtIHB5dGhvbgoKd3JpdGVfZmlsZXM6CiAgLSBwYXRoOiAvZXRjL25ldHdvcmsvaW50ZXJmYWNlcy5kLzUwLWNsb3VkLWluaXQuY2ZnCiAgICBjb250ZW50OiB8CiAgICAgIGF1dG8gbG8KICAgICAgaWZhY2UgbG8gaW5ldCBsb29wYmFjawogICAgICAKICAgICAgYXV0byBlbnMwCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMAogICAgICBpZmFjZSBlbnMwIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMxCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMQogICAgICBpZmFjZSBlbnMxIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMyCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMgogICAgICBpZmFjZSBlbnMyIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMzCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMwogICAgICBpZmFjZSBlbnMzIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM0CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNAogICAgICBpZmFjZSBlbnM0IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM1CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNQogICAgICBpZmFjZSBlbnM1IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM2CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNgogICAgICBpZmFjZSBlbnM2IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM3CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNwogICAgICBpZmFjZSBlbnM3IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM4CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zOAogICAgICBpZmFjZSBlbnM4IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM5CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zOQogICAgICBpZmFjZSBlbnM5IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMxMAogICAgICBhbGxvdy1ob3RwbHVnIGVuczEwCiAgICAgIGlmYWNlIGVuczEwIGluZXQgZGhjcAoKIyMj"; - @BeforeClass - public static void OCCIRegistrySetup() { + public static void OCCIRegistrySetup() { TestUtility.loggerSetup(); TestUtility.extensionRegistrySetup(); } - + public void deprovisionEverything() { CachedResourceSet.getCache().clear(); Path occiPath = Paths.get(ModelUtility.getPathToResource("occi/Empty.occic")); @@ -45,19 +45,28 @@ public class DeployHadoopMonitoringTestLive { Path occiPath = Paths.get(ModelUtility.getPathToResource("occi/hadoopClusterNewExtWithMem.occic")); Transformator trans = TransformatorFactory.getTransformator("OCCI2OCCI"); - trans.transform(occiPath, occiPath); - - OCCI2OPENSTACKTransformator trans2 = OCCI2OPENSTACKTransformator.getInstance(); + try { + trans.transform(occiPath, occiPath); + } catch (EolRuntimeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + OCCI2OPENSTACKTransformator trans2 = new OCCI2OPENSTACKTransformator(); trans2.setTransformationProperties(manNWRuntimeId, sshKey, userData, manNWid); - - trans2.transform(occiPath, occiPath); - + + try { + trans2.transform(occiPath, occiPath); + } catch (EolRuntimeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } Connector conn = new MartConnector("192.168.35.45", 8080, "ubuntu", "~/key.pem"); MartDeployer deployer = new MartDeployer(conn); deployer.deploy(occiPath); - + assertTrue(TestUtility.equalsRuntime(occiPath, conn)); } diff --git a/src/test/java/de/ugoe/cs/rwm/mocci/live/EmptyTestLive.java b/src/test/java/de/ugoe/cs/rwm/mocci/live/EmptyTestLive.java index 3d6d6551b621e3c948d1739c695fef4451b3e6ed..26e733b775b35def76de8d6df99a103f1ef76bcd 100644 --- a/src/test/java/de/ugoe/cs/rwm/mocci/live/EmptyTestLive.java +++ b/src/test/java/de/ugoe/cs/rwm/mocci/live/EmptyTestLive.java @@ -1,38 +1,17 @@ package de.ugoe.cs.rwm.mocci.live; -import static org.junit.Assert.assertTrue; - import java.nio.file.Path; import java.nio.file.Paths; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.eclipse.cmf.occi.core.Configuration; -import org.eclipse.cmf.occi.core.Link; -import org.eclipse.cmf.occi.core.Mixin; -import org.eclipse.cmf.occi.core.OCCIPackage; -import org.eclipse.cmf.occi.core.util.OcciRegistry; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.epsilon.emc.emf.CachedResourceSet; -import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import de.ugoe.cs.rwm.docci.MartDeployer; import de.ugoe.cs.rwm.docci.ModelUtility; -import de.ugoe.cs.rwm.mocci.TestUtility; import de.ugoe.cs.rwm.docci.connector.Connector; -import de.ugoe.cs.rwm.docci.connector.LocalhostConnector; import de.ugoe.cs.rwm.docci.connector.MartConnector; -import de.ugoe.cs.rwm.tocci.Transformator; -import de.ugoe.cs.rwm.tocci.TransformatorFactory; -import de.ugoe.cs.rwm.tocci.occi2openstack.OCCI2OPENSTACKTransformator; -import monitoring.MonitoringPackage; +import de.ugoe.cs.rwm.mocci.TestUtility; public class EmptyTestLive { String manNWid = "urn:uuid:29d78078-fb4c-47aa-a9af-b8aaf3339590"; @@ -40,13 +19,12 @@ public class EmptyTestLive { String sshKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6H7Ydi45BTHid4qNppGAi5mzjbnZgt7bi6xLGmZG9CiLmhMsxOuk3Z05Nn+pmoN98qS0eY8S240PPk5VOlYqBY0vdRAwrZSHHaLdMp6I7ARNrI2KraYduweqz7ZQxPXQfwIeYx2HKQxEF2r+4//Fo4WfgdBkLuulvl/Gw3TUzJNQHvgpaiNo9+PI5CZydHnZbjUkRikS12pT+CbNKj+0QKeQztbCd41aKxDv5H0DjltVRcpPppv4dmiU/zoCAIngWLO1PPgfYWyze8Z9IoyBT7Qdg30U91TYZBuxzXR5lq7Fh64y/IZ/SjdOdSIvIuDjtmJDULRdLJzrvubrKY+YH Generated-by-Nova"; String userData = "I2Nsb3VkLWNvbmZpZwoKIyBVcGdyYWRlIHRoZSBpbnN0YW5jZSBvbiBmaXJzdCBib290CiMgKGllIHJ1biBhcHQtZ2V0IHVwZ3JhZGUpCiMKIyBEZWZhdWx0OiBmYWxzZQojIEFsaWFzZXM6IGFwdF91cGdyYWRlCnBhY2thZ2VfdXBncmFkZTogdHJ1ZQoKcGFja2FnZXM6CiAtIHB5dGhvbgoKd3JpdGVfZmlsZXM6CiAgLSBwYXRoOiAvZXRjL25ldHdvcmsvaW50ZXJmYWNlcy5kLzUwLWNsb3VkLWluaXQuY2ZnCiAgICBjb250ZW50OiB8CiAgICAgIGF1dG8gbG8KICAgICAgaWZhY2UgbG8gaW5ldCBsb29wYmFjawogICAgICAKICAgICAgYXV0byBlbnMwCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMAogICAgICBpZmFjZSBlbnMwIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMxCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMQogICAgICBpZmFjZSBlbnMxIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMyCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMgogICAgICBpZmFjZSBlbnMyIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMzCiAgICAgIGFsbG93LWhvdHBsdWcgZW5zMwogICAgICBpZmFjZSBlbnMzIGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM0CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNAogICAgICBpZmFjZSBlbnM0IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM1CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNQogICAgICBpZmFjZSBlbnM1IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM2CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNgogICAgICBpZmFjZSBlbnM2IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM3CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zNwogICAgICBpZmFjZSBlbnM3IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM4CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zOAogICAgICBpZmFjZSBlbnM4IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnM5CiAgICAgIGFsbG93LWhvdHBsdWcgZW5zOQogICAgICBpZmFjZSBlbnM5IGluZXQgZGhjcAogICAgICAKICAgICAgYXV0byBlbnMxMAogICAgICBhbGxvdy1ob3RwbHVnIGVuczEwCiAgICAgIGlmYWNlIGVuczEwIGluZXQgZGhjcAoKIyMj"; - @BeforeClass - public static void OCCIRegistrySetup() { + public static void OCCIRegistrySetup() { TestUtility.loggerSetup(); TestUtility.extensionRegistrySetup(); } - + @Test public void deprovisionEverything() { CachedResourceSet.getCache().clear(); diff --git a/src/test/java/de/ugoe/cs/rwm/mocci/live/package-info.java b/src/test/java/de/ugoe/cs/rwm/mocci/live/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..b6a9aa21a2a9c4e6493d763f95ebedd96f143434 --- /dev/null +++ b/src/test/java/de/ugoe/cs/rwm/mocci/live/package-info.java @@ -0,0 +1,10 @@ +/** + * + */ +/** + * Main package that includes MOCCI live tests. + * + * @author erbel + * + */ +package de.ugoe.cs.rwm.mocci.live; diff --git a/src/test/resources/martserver-plugins/de.ugoe.cs.rwm.mocci.connector.dummy.jar b/src/test/resources/martserver-plugins/de.ugoe.cs.rwm.mocci.connector.dummy.jar index 1ef9810d18a9541eeb5fb4aae3db163426b83f56..85e5c798dfe9fcca9d13102397bc19d58d03104a 100644 Binary files a/src/test/resources/martserver-plugins/de.ugoe.cs.rwm.mocci.connector.dummy.jar and b/src/test/resources/martserver-plugins/de.ugoe.cs.rwm.mocci.connector.dummy.jar differ diff --git a/src/test/resources/occi/hadoopClusterCPU.occic b/src/test/resources/occi/hadoopClusterCPU.occic index 64b7410ed9fa51fbe002e808439a26049b8f5d53..9974f732279f7342b26da33e4c76053c890137ef 100644 --- a/src/test/resources/occi/hadoopClusterCPU.occic +++ b/src/test/resources/occi/hadoopClusterCPU.occic @@ -73,7 +73,7 @@ <attributes name="occi.core.target" value="/compute/urn:uuid:2e6a73d0-faaa-476a-bd25-ca461dd166ce/"/> </links> </resources> - <resources xsi:type="platform:Application" id="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" title="Hadoopcluster" location="/application/urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" occiAppName="" occiAppState="deployed"> + <resources xsi:type="platform:Application" id="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" title="Hadoopcluster" location="/application/urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" occiAppName="" occiAppState="undeployed"> <kind href="http://schemas.modmacao.org/occi/platform#//@kinds[term='application']"/> <attributes name="occi.core.id" value="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d"/> <attributes name="occi.core.title" value="Hadoopcluster"/> @@ -236,7 +236,7 @@ <attributes name="occi.core.title" value="link2"/> </links> </resources> - <resources xsi:type="infrastructure:Compute" id="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea" title="MonVm" rlinks="//@resources.9/@links.1 //@resources.10/@links.1" occiComputeHostname="monVM"> + <resources xsi:type="infrastructure:Compute" id="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea" title="MonVm" rlinks="//@resources.9/@links.1 //@resources.10/@links.1" occiComputeState="active" occiComputeHostname="monVM"> <kind href="http://schemas.ogf.org/occi/infrastructure#//@kinds[term='compute']"/> <attributes name="occi.core.id" value="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea"/> <attributes name="occi.core.title" value="MonVm"/> @@ -261,7 +261,7 @@ </parts> </links> </resources> - <resources xsi:type="infrastructure:Network" id="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a" title="MonitoringNetwork" rlinks="//@resources.11/@links.0 //@resources.4/@links.1"> + <resources xsi:type="infrastructure:Network" id="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a" title="MonitoringNetwork" occiNetworkState="active" rlinks="//@resources.11/@links.0 //@resources.4/@links.1"> <kind href="http://schemas.ogf.org/occi/infrastructure#//@kinds[term='network']"/> <attributes name="occi.core.id" value="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a"/> <attributes name="occi.core.title" value="MonitoringNetwork"/> diff --git a/src/test/resources/occi/hadoopClusterNewExtWithMem.occic b/src/test/resources/occi/hadoopClusterNewExtWithMem.occic index 468d6456b9697e3ffe0d8a4e243950dd87bc1ad2..a98c32ef23d69b873379bd0d0f16f77ac2fd9f86 100644 --- a/src/test/resources/occi/hadoopClusterNewExtWithMem.occic +++ b/src/test/resources/occi/hadoopClusterNewExtWithMem.occic @@ -73,7 +73,7 @@ <attributes name="occi.core.target" value="/compute/urn:uuid:2e6a73d0-faaa-476a-bd25-ca461dd166ce/"/> </links> </resources> - <resources xsi:type="platform:Application" id="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" title="Hadoopcluster" location="/application/urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" occiAppName="" occiAppState="deployed"> + <resources xsi:type="platform:Application" id="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" title="Hadoopcluster" location="/application/urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d" occiAppName="" occiAppState="undeployed"> <kind href="http://schemas.modmacao.org/occi/platform#//@kinds[term='application']"/> <attributes name="occi.core.id" value="urn:uuid:a4888ba9-a0ea-48f2-a29e-901c876ab42d"/> <attributes name="occi.core.title" value="hadoopcluster"/> @@ -236,7 +236,7 @@ <attributes name="occi.core.title" value="link2"/> </links> </resources> - <resources xsi:type="infrastructure:Compute" id="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea" title="MonVm" rlinks="//@resources.9/@links.1 //@resources.10/@links.1 //@resources.13/@links.1 //@resources.14/@links.1" occiComputeHostname="monVM" occiComputeState="inactive"> + <resources xsi:type="infrastructure:Compute" id="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea" title="MonVm" rlinks="//@resources.9/@links.1 //@resources.10/@links.1 //@resources.13/@links.1 //@resources.14/@links.1" occiComputeHostname="monVM" occiComputeState="active"> <kind href="http://schemas.ogf.org/occi/infrastructure#//@kinds[term='compute']"/> <attributes name="occi.core.id" value="urn:uuid:37829092-c690-494a-98fa-335b2fd660ea"/> <attributes name="occi.core.title" value="MonVm"/> @@ -261,7 +261,7 @@ </parts> </links> </resources> - <resources xsi:type="infrastructure:Network" id="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a" title="MonitoringNetwork" rlinks="//@resources.11/@links.0 //@resources.4/@links.1" occiNetworkState="inactive"> + <resources xsi:type="infrastructure:Network" id="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a" title="MonitoringNetwork" rlinks="//@resources.11/@links.0 //@resources.4/@links.1" occiNetworkState="active"> <kind href="http://schemas.ogf.org/occi/infrastructure#//@kinds[term='network']"/> <attributes name="occi.core.id" value="urn:uuid:7a9fca2c-24fb-473c-aa9c-8dc9e68a432a"/> <attributes name="occi.core.title" value="MonitoringNetwork"/>