params = new LinkedHashMap<>();
-
- final Document xml = convertStringToDocument(xmlString);
- final Node parent = xml.getFirstChild();
- final NodeList childs = parent.getChildNodes();
- Node child;
- for (int i = 0; i < childs.getLength(); i++) {
- child = childs.item(i);
-
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- params.put(child.getNodeName(), child.getTextContent());
- }
- }
-
- return params;
- }
-
- private static Document convertStringToDocument(final String xmlString) throws SAXException {
- final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder;
-
- try {
- builder = factory.newDocumentBuilder();
- final Document doc = builder.parse(new InputSource(new StringReader(xmlString)));
- return doc;
- }
- catch (ParserConfigurationException | IOException e) {
- e.printStackTrace();
- }
- return null;
-
- }
-}
diff --git a/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/processor/InvocationResponseProcessor.java b/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/processor/InvocationResponseProcessor.java
deleted file mode 100644
index 5967fff3b..000000000
--- a/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/processor/InvocationResponseProcessor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.opentosca.bus.application.api.resthttp.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.restlet.RestletConstants;
-import org.opentosca.bus.application.api.resthttp.route.Route;
-import org.restlet.Response;
-import org.restlet.data.Status;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * InvocationResponseProcessor of the Application Bus-REST/HTTP-API.
- *
- *
- * This processor handles the responses of "invokeOperation" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class InvocationResponseProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(InvocationResponseProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- InvocationResponseProcessor.LOG.debug("Processing Invocation response....");
-
- final String requestID = exchange.getIn().getBody(String.class);
-
- InvocationResponseProcessor.LOG.debug("RequestID: {}", requestID);
-
- final String invokeURI = exchange.getIn().getHeader(Exchange.HTTP_URI, String.class);
- final String pollingURI = invokeURI + Route.POLL_ENDPOINT_SUFFIX.replace(Route.ID_PLACEHODLER, requestID);
-
- InvocationResponseProcessor.LOG.debug("Polling URI: {}", pollingURI);
-
- final Response response = exchange.getIn().getHeader(RestletConstants.RESTLET_RESPONSE, Response.class);
- response.setStatus(Status.SUCCESS_ACCEPTED);
- response.setLocationRef(pollingURI);
- exchange.getOut().setBody(response);
-
- }
-
-}
diff --git a/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/processor/IsFinishedRequestProcessor.java b/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/processor/IsFinishedRequestProcessor.java
deleted file mode 100644
index d953eb2d6..000000000
--- a/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/processor/IsFinishedRequestProcessor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.opentosca.bus.application.api.resthttp.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.opentosca.bus.application.api.resthttp.route.Route;
-import org.opentosca.bus.application.model.constants.ApplicationBusConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * IsFinishedRequestProcessor of the Application Bus-REST/HTTP-API.
- *
- *
- * This processor handles "isFinished" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class IsFinishedRequestProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(IsFinishedRequestProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- IsFinishedRequestProcessor.LOG.debug("Processing IsFinished request....");
-
- final Integer requestID = exchange.getIn().getHeader(Route.ID, Integer.class);
-
- IsFinishedRequestProcessor.LOG.debug("RequestID: {}", requestID);
-
- exchange.getIn().setBody(requestID);
-
- exchange.getIn().setHeader(ApplicationBusConstants.APPLICATION_BUS_METHOD.toString(),
- ApplicationBusConstants.APPLICATION_BUS_METHOD_IS_FINISHED.toString());
-
- }
-
-}
diff --git a/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/processor/IsFinishedResponseProcessor.java b/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/processor/IsFinishedResponseProcessor.java
deleted file mode 100644
index f765919e0..000000000
--- a/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/processor/IsFinishedResponseProcessor.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.opentosca.bus.application.api.resthttp.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.restlet.RestletConstants;
-import org.json.simple.JSONObject;
-import org.opentosca.bus.application.api.resthttp.route.Route;
-import org.opentosca.bus.application.model.exception.ApplicationBusExternalException;
-import org.restlet.Response;
-import org.restlet.data.MediaType;
-import org.restlet.data.Status;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * IsFinishedResponseProcessor of the Application Bus-REST/HTTP-API.
- *
- *
- * This processor handles the responses of "isFinished" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class IsFinishedResponseProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(IsFinishedResponseProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- IsFinishedResponseProcessor.LOG.debug("Processing IsFinished response....");
-
- final String requestID = exchange.getIn().getHeader(Route.ID, String.class);
-
- IsFinishedResponseProcessor.LOG.debug("RequestID: {}", requestID);
-
- final Response response = exchange.getIn().getHeader(RestletConstants.RESTLET_RESPONSE, Response.class);
-
- if (exchange.getIn().getBody() instanceof Exception) {
-
- response.setStatus(Status.CLIENT_ERROR_NOT_FOUND);
- response.setEntity(exchange.getIn().getBody(String.class), MediaType.TEXT_ALL);
-
- } else {
-
- final Boolean isFinished = exchange.getIn().getBody(Boolean.class);
-
- if (isFinished) {
- IsFinishedResponseProcessor.LOG.debug("Invocation has finished, send location of result.");
-
- final String pollingURI = exchange.getIn().getHeader(Exchange.HTTP_URI, String.class);
- final String getResultURI =
- pollingURI + Route.GET_RESULT_ENDPOINT_SUFFIX.replace(Route.ID_PLACEHODLER, requestID);
-
- IsFinishedResponseProcessor.LOG.debug("GetResult URI: {}", getResultURI);
-
- response.setStatus(Status.REDIRECTION_SEE_OTHER);
- response.setLocationRef(getResultURI);
-
- } else {
- IsFinishedResponseProcessor.LOG.debug("Invocation has not finished yet.");
-
- final String acceptContentType = exchange.getIn().getHeader(Exchange.ACCEPT_CONTENT_TYPE, String.class);
-
- IsFinishedResponseProcessor.LOG.debug("AcceptContentType: {}", acceptContentType);
-
- if (acceptContentType.equals(MediaType.APPLICATION_JSON)) {
-
- final JSONObject obj = new JSONObject();
- obj.put("status", "PENDING");
-
- response.setStatus(Status.SUCCESS_OK);
- response.setEntity(obj.toJSONString(), MediaType.APPLICATION_JSON);
-
- } else if (acceptContentType.equals(MediaType.APPLICATION_XML)) {
-
- response.setStatus(Status.SUCCESS_OK);
- response.setEntity("PENDING", MediaType.APPLICATION_XML);
-
- } else {
- IsFinishedResponseProcessor.LOG.warn("The requested entity media type is not supported.");
- throw new ApplicationBusExternalException("The requested entity media type is not supported.",
- Status.CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE.getCode());
- }
-
- }
- exchange.getOut().setBody(response);
- }
- }
-
-}
diff --git a/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/route/Route.java b/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/route/Route.java
deleted file mode 100644
index dcfb539bd..000000000
--- a/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/route/Route.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.opentosca.bus.application.api.resthttp.route;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Predicate;
-import org.apache.camel.builder.PredicateBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.ValueBuilder;
-import org.opentosca.bus.application.api.resthttp.processor.ExceptionProcessor;
-import org.opentosca.bus.application.api.resthttp.processor.GetResultRequestProcessor;
-import org.opentosca.bus.application.api.resthttp.processor.GetResultResponseProcessor;
-import org.opentosca.bus.application.api.resthttp.processor.InvocationRequestProcessor;
-import org.opentosca.bus.application.api.resthttp.processor.InvocationResponseProcessor;
-import org.opentosca.bus.application.api.resthttp.processor.IsFinishedRequestProcessor;
-import org.opentosca.bus.application.api.resthttp.processor.IsFinishedResponseProcessor;
-import org.opentosca.bus.application.api.resthttp.servicehandler.ApplicationBusServiceHandler;
-import org.opentosca.bus.application.model.exception.ApplicationBusInternalException;
-
-/**
- * Route of the Application Bus-REST/HTTP-API.
- *
- *
- * The endpoint of the REST/HTTP-API is created here. Incoming requests will be routed to processors
- * or the application bus in order to handle the requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Route extends RouteBuilder {
-
-
- private static final String HOST = "http://localhost";
-
- private static final String PORT = "8085";
- private static final String BASE_ENDPOINT = Route.HOST + ":" + Route.PORT;
-
- public static final String SI = "ServiceInstanceID";
- public static final String NT = "NodeTemplateID";
- public static final String NI = "NodeInstanceID";
- public static final String IN = "InterfaceName";
- public static final String ON = "OperationName";
-
- public static final String INVOKE_ENDPOINT_SI = "/OTABService/v1/ServiceInstances/{" + Route.SI + "}/Nodes/{"
- + Route.NT + "}/ApplicationInterfaces/{" + Route.IN + "}/Operations/{" + Route.ON + "}";
- public static final String INVOKE_ENDPOINT_NI = "/OTABService/v1/NodeInstances/{" + Route.NI
- + "}/ApplicationInterfaces/{" + Route.IN + "}/Operations/{" + Route.ON + "}";
-
- public static final String ID = "id";
- public static final String ID_PLACEHODLER = "{" + Route.ID + "}";
-
- public static final String POLL_ENDPOINT_SUFFIX = "/activeRequests/" + Route.ID_PLACEHODLER;
-
- public static final String POLL_ENDPOINT_SI = Route.INVOKE_ENDPOINT_SI + Route.POLL_ENDPOINT_SUFFIX;
- public static final String POLL_ENDPOINT_NI = Route.INVOKE_ENDPOINT_NI + Route.POLL_ENDPOINT_SUFFIX;
-
- public static final String GET_RESULT_ENDPOINT_SUFFIX = "/response";
-
- public static final String GET_RESULT_ENDPOINT_SI = Route.POLL_ENDPOINT_SI + Route.GET_RESULT_ENDPOINT_SUFFIX;
- public static final String GET_RESULT_ENDPOINT_NI = Route.POLL_ENDPOINT_NI + Route.GET_RESULT_ENDPOINT_SUFFIX;
-
- private static final String TO_APP_BUS_ENDPOINT = "direct:toAppBus";
-
-
- @Override
- public void configure() throws Exception {
-
- final ValueBuilder APP_BUS_ENDPOINT =
- new ValueBuilder(this.method(ApplicationBusServiceHandler.class, "getApplicationBusRoutingEndpoint"));
- final Predicate APP_BUS_ENDPOINT_EXISTS = PredicateBuilder.isNotNull(APP_BUS_ENDPOINT);
-
- final InvocationRequestProcessor invocationRequestProcessor = new InvocationRequestProcessor();
- final InvocationResponseProcessor invocationResponseProcessor = new InvocationResponseProcessor();
- final IsFinishedRequestProcessor isFinishedRequestProcessor = new IsFinishedRequestProcessor();
- final IsFinishedResponseProcessor isFinishedResponseProcessor = new IsFinishedResponseProcessor();
- final GetResultRequestProcessor getResultRequestProcessor = new GetResultRequestProcessor();
- final GetResultResponseProcessor getResultResponseProcessor = new GetResultResponseProcessor();
- final ExceptionProcessor exceptionProcessor = new ExceptionProcessor();
-
- // handle exceptions
-
- this.onException(Exception.class).handled(true).setBody(property(Exchange.EXCEPTION_CAUGHT))
- .process(exceptionProcessor);
-
- // INVOKE ROUTES
- // invoke route (for ServiceInstance)
- this.from("restlet:" + Route.BASE_ENDPOINT + Route.INVOKE_ENDPOINT_SI + "?restletMethods=post")
- .to("direct:invoke");
-
- // invoke route (for NodeInstance)
- this.from("restlet:" + Route.BASE_ENDPOINT + Route.INVOKE_ENDPOINT_NI + "?restletMethods=post")
- .to("direct:invoke");
-
- // invoke route
- this.from("direct:invoke").process(invocationRequestProcessor).to(Route.TO_APP_BUS_ENDPOINT).choice()
- .when(property(Exchange.EXCEPTION_CAUGHT).isNull()).process(invocationResponseProcessor).removeHeaders("*")
- .otherwise().process(exceptionProcessor);
-
-
- // IS FINISHED ROUTES
- // isFinished route (for ServiceInstance)
- this.from("restlet:" + Route.BASE_ENDPOINT + Route.POLL_ENDPOINT_SI + "?restletMethods=get")
- .to("direct:isFinished");
-
- // isFinished route (for NodeInstance)
- this.from("restlet:" + Route.BASE_ENDPOINT + Route.POLL_ENDPOINT_NI + "?restletMethods=get")
- .to("direct:isFinished");
-
- // isFinished route
- this.from("direct:isFinished").process(isFinishedRequestProcessor).to(Route.TO_APP_BUS_ENDPOINT)
- .process(isFinishedResponseProcessor).removeHeaders("*");
-
- // GET RESULT ROUTES
- // getResult route (for ServiceInstance)
- this.from("restlet:" + Route.BASE_ENDPOINT + Route.GET_RESULT_ENDPOINT_SI + "?restletMethods=get")
- .to("direct:getResult");
-
- // getResult route (for NodeInstance)
- this.from("restlet:" + Route.BASE_ENDPOINT + Route.GET_RESULT_ENDPOINT_NI + "?restletMethods=get")
- .to("direct:getResult");
-
- // getResult route
- this.from("direct:getResult").process(getResultRequestProcessor).to(Route.TO_APP_BUS_ENDPOINT)
- .process(getResultResponseProcessor).removeHeaders("*");
-
- // applicationBus route, throws exception if Application Bus is not
- // running or wasn't binded
- this.from(Route.TO_APP_BUS_ENDPOINT).choice().when(APP_BUS_ENDPOINT_EXISTS).recipientList(APP_BUS_ENDPOINT)
- .endChoice().otherwise().to("direct:handleException");
-
- // handle exception if Application Bus is not running or wasn't binded
- this.from("direct:handleException")
- .throwException(new ApplicationBusInternalException("The Application Bus is not running."));
-
- }
-
-}
diff --git a/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/servicehandler/ApplicationBusServiceHandler.java b/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/servicehandler/ApplicationBusServiceHandler.java
deleted file mode 100644
index 532630338..000000000
--- a/org.opentosca.bus.application.api.resthttp/src/org/opentosca/bus/application/api/resthttp/servicehandler/ApplicationBusServiceHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.opentosca.bus.application.api.resthttp.servicehandler;
-
-import org.opentosca.bus.application.service.IApplicationBusService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Service Handler of the Application Bus-REST/HTTP-API.
- *
- *
- * Here the implementation of the IApplicationBusService is binded or unbinded. During the binding
- * the routing endpoint of the Application Bus is handed over.
- *
- *
- * @see IApplicationBusService
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class ApplicationBusServiceHandler {
-
- // Routing endpoint of the IApplicationBus implementation.
- private static String applicationBusRoutingEndpoint = null;
-
- final private static Logger LOG = LoggerFactory.getLogger(ApplicationBusServiceHandler.class);
-
- /**
- * @return The Routing endpoint of the ApplicationBus
- */
- public String getApplicationBusRoutingEndpoint() {
-
- return applicationBusRoutingEndpoint;
- }
-
- /**
- * Bind ApplicationBusService
- *
- * @param appBus - The ApplicationBusService to register.
- */
- public void bindApplicationBusService(final IApplicationBusService appBus) {
-
- applicationBusRoutingEndpoint = appBus.getRoutingEndpoint();
-
- ApplicationBusServiceHandler.LOG.debug("Bound ApplicationBusService: {} with Endpoint: {}", appBus.toString(),
- applicationBusRoutingEndpoint);
-
- }
-
- /**
- * Unbind ApplicationBusService.
- *
- * @param appBus - The ApplicationBusService to unregister.
- */
- public void unbindApplicationBusService(final IApplicationBusService appBus) {
- ApplicationBusServiceHandler.LOG.debug("Unbind ApplicationBusService: {} with Endpoint: {}", appBus.toString(),
- applicationBusRoutingEndpoint);
- applicationBusRoutingEndpoint = null;
- }
-}
diff --git a/org.opentosca.bus.application.api.soaphttp/META-INF/MANIFEST.MF b/org.opentosca.bus.application.api.soaphttp/META-INF/MANIFEST.MF
deleted file mode 100644
index 3d3949163..000000000
--- a/org.opentosca.bus.application.api.soaphttp/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,24 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Application Bus Soap over http API
-Bundle-SymbolicName: org.opentosca.bus.application.api.soaphttp
-Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.opentosca.bus.application.api.soaphttp.Activator
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.apache.camel;version="2.10.4",
- org.apache.camel.builder;version="2.10.4",
- org.apache.camel.component.cxf.common.message;version="2.10.4",
- org.apache.camel.converter.jaxb;version="2.10.4",
- org.apache.camel.core.osgi;version="2.10.4",
- org.apache.camel.impl;version="2.10.4",
- org.apache.camel.model;version="2.10.4",
- org.apache.camel.spi;version="2.10.4",
- org.apache.cxf.binding.soap;version="2.7.3",
- org.apache.cxf.headers;version="2.7.3",
- org.osgi.framework;version="1.6.0",
- org.slf4j;version="1.7.5"
-Require-Bundle: org.opentosca.container.core;bundle-version="1.0.0",
- org.opentosca.bus.application.model;bundle-version="1.0.0",
- org.opentosca.bus.application.service;bundle-version="1.0.0"
-Service-Component: OSGI-INF/*
-Bundle-ActivationPolicy: lazy
diff --git a/org.opentosca.bus.application.api.soaphttp/OSGI-INF/ApplicationBusServiceHandler_component.xml b/org.opentosca.bus.application.api.soaphttp/OSGI-INF/ApplicationBusServiceHandler_component.xml
deleted file mode 100644
index f79077e60..000000000
--- a/org.opentosca.bus.application.api.soaphttp/OSGI-INF/ApplicationBusServiceHandler_component.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/org.opentosca.bus.application.api.soaphttp/build.properties b/org.opentosca.bus.application.api.soaphttp/build.properties
deleted file mode 100644
index 686be4f32..000000000
--- a/org.opentosca.bus.application.api.soaphttp/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
diff --git a/org.opentosca.bus.application.api.soaphttp/pom.xml b/org.opentosca.bus.application.api.soaphttp/pom.xml
deleted file mode 100644
index 0f15b197f..000000000
--- a/org.opentosca.bus.application.api.soaphttp/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.application.api.soaphttp
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/Activator.java b/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/Activator.java
deleted file mode 100644
index 089fa1ceb..000000000
--- a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/Activator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.opentosca.bus.application.api.soaphttp;
-
-import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
-import org.apache.camel.core.osgi.OsgiServiceRegistry;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.opentosca.bus.application.api.soaphttp.route.Route;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Activator of the SOAP/HTTP-Application Bus-API.
- *
- *
- * The activator is needed to add and start the camel routes.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Activator implements BundleActivator {
-
- final private static Logger LOG = LoggerFactory.getLogger(Activator.class);
-
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
-
- final DefaultCamelContext camelContext = new OsgiDefaultCamelContext(bundleContext);
-
- camelContext.addRoutes(new Route());
-
- camelContext.start();
-
- Activator.LOG.info("Application Bus SOAP API started!");
- }
-
- @Override
- public void stop(final BundleContext arg0) throws Exception {
-
- Activator.LOG.info("Application Bus SOAP API stopped!");
- }
-
-}
diff --git a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/model/ObjectFactory.java b/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/model/ObjectFactory.java
deleted file mode 100644
index fda44d4b0..000000000
--- a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/model/ObjectFactory.java
+++ /dev/null
@@ -1,233 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, v2.2.4-2
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.02.25 at 04:54:56 PM CET
-//
-
-
-package org.opentosca.bus.application.api.soaphttp.model;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlElementDecl;
-import javax.xml.bind.annotation.XmlRegistry;
-import javax.xml.namespace.QName;
-
-
-/**
- * This object contains factory methods for each Java content interface and Java element interface
- * generated in the org.opentosca.bus.application.api.soaphttp.model package.
- *
- * An ObjectFactory allows you to programatically construct new instances of the Java representation
- * for XML content. The Java representation of XML content can consist of schema derived interfaces
- * and classes representing the binding of schema type definitions, element declarations and model
- * groups. Factory methods for each of these are provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
- private final static QName _GetResultResponse_QNAME =
- new QName("http://opentosca.org/appinvoker/", "getResultResponse");
- private final static QName _InvokeMethodWithNodeInstanceID_QNAME =
- new QName("http://opentosca.org/appinvoker/", "invokeMethodWithNodeInstanceID");
- private final static QName _InvokeMethodWithNodeInstanceIDResponse_QNAME =
- new QName("http://opentosca.org/appinvoker/", "invokeMethodWithNodeInstanceIDResponse");
- private final static QName _IsFinishedResponse_QNAME =
- new QName("http://opentosca.org/appinvoker/", "isFinishedResponse");
- private final static QName _InvokeMethodWithServiceInstanceIDResponse_QNAME =
- new QName("http://opentosca.org/appinvoker/", "invokeMethodWithServiceInstanceIDResponse");
- private final static QName _ApplicationBusException_QNAME =
- new QName("http://opentosca.org/appinvoker/", "ApplicationBusException");
- private final static QName _GetResult_QNAME = new QName("http://opentosca.org/appinvoker/", "getResult");
- private final static QName _InvokeMethodWithServiceInstanceID_QNAME =
- new QName("http://opentosca.org/appinvoker/", "invokeMethodWithServiceInstanceID");
- private final static QName _IsFinished_QNAME = new QName("http://opentosca.org/appinvoker/", "isFinished");
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for
- * package: org.opentosca.bus.application.api.soaphttp.model
- *
- */
- public ObjectFactory() {}
-
- /**
- * Create an instance of {@link IsFinishedResponse }
- *
- */
- public IsFinishedResponse createIsFinishedResponse() {
- return new IsFinishedResponse();
- }
-
- /**
- * Create an instance of {@link InvokeMethodWithNodeInstanceIDResponse }
- *
- */
- public InvokeMethodWithNodeInstanceIDResponse createInvokeMethodWithNodeInstanceIDResponse() {
- return new InvokeMethodWithNodeInstanceIDResponse();
- }
-
- /**
- * Create an instance of {@link InvokeMethodWithNodeInstanceID }
- *
- */
- public InvokeMethodWithNodeInstanceID createInvokeMethodWithNodeInstanceID() {
- return new InvokeMethodWithNodeInstanceID();
- }
-
- /**
- * Create an instance of {@link GetResultResponse }
- *
- */
- public GetResultResponse createGetResultResponse() {
- return new GetResultResponse();
- }
-
- /**
- * Create an instance of {@link IsFinished }
- *
- */
- public IsFinished createIsFinished() {
- return new IsFinished();
- }
-
- /**
- * Create an instance of {@link InvokeMethodWithServiceInstanceID }
- *
- */
- public InvokeMethodWithServiceInstanceID createInvokeMethodWithServiceInstanceID() {
- return new InvokeMethodWithServiceInstanceID();
- }
-
- /**
- * Create an instance of {@link GetResult }
- *
- */
- public GetResult createGetResult() {
- return new GetResult();
- }
-
- /**
- * Create an instance of {@link ApplicationBusException }
- *
- */
- public ApplicationBusException createApplicationBusException() {
- return new ApplicationBusException();
- }
-
- /**
- * Create an instance of {@link InvokeMethodWithServiceInstanceIDResponse }
- *
- */
- public InvokeMethodWithServiceInstanceIDResponse createInvokeMethodWithServiceInstanceIDResponse() {
- return new InvokeMethodWithServiceInstanceIDResponse();
- }
-
- /**
- * Create an instance of {@link ParamsMapItemType }
- *
- */
- public ParamsMapItemType createParamsMapItemType() {
- return new ParamsMapItemType();
- }
-
- /**
- * Create an instance of {@link ParamsMap }
- *
- */
- public ParamsMap createParamsMap() {
- return new ParamsMap();
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link GetResultResponse }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://opentosca.org/appinvoker/", name = "getResultResponse")
- public JAXBElement createGetResultResponse(final GetResultResponse value) {
- return new JAXBElement<>(_GetResultResponse_QNAME, GetResultResponse.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link InvokeMethodWithNodeInstanceID
- * }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://opentosca.org/appinvoker/", name = "invokeMethodWithNodeInstanceID")
- public JAXBElement createInvokeMethodWithNodeInstanceID(final InvokeMethodWithNodeInstanceID value) {
- return new JAXBElement<>(_InvokeMethodWithNodeInstanceID_QNAME, InvokeMethodWithNodeInstanceID.class, null,
- value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link InvokeMethodWithNodeInstanceIDResponse
- * }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://opentosca.org/appinvoker/", name = "invokeMethodWithNodeInstanceIDResponse")
- public JAXBElement createInvokeMethodWithNodeInstanceIDResponse(final InvokeMethodWithNodeInstanceIDResponse value) {
- return new JAXBElement<>(_InvokeMethodWithNodeInstanceIDResponse_QNAME,
- InvokeMethodWithNodeInstanceIDResponse.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link IsFinishedResponse }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://opentosca.org/appinvoker/", name = "isFinishedResponse")
- public JAXBElement createIsFinishedResponse(final IsFinishedResponse value) {
- return new JAXBElement<>(_IsFinishedResponse_QNAME, IsFinishedResponse.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement
- * }{@code <}{@link InvokeMethodWithServiceInstanceIDResponse }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://opentosca.org/appinvoker/", name = "invokeMethodWithServiceInstanceIDResponse")
- public JAXBElement createInvokeMethodWithServiceInstanceIDResponse(final InvokeMethodWithServiceInstanceIDResponse value) {
- return new JAXBElement<>(_InvokeMethodWithServiceInstanceIDResponse_QNAME,
- InvokeMethodWithServiceInstanceIDResponse.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link ApplicationBusException }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://opentosca.org/appinvoker/", name = "ApplicationBusException")
- public JAXBElement createApplicationBusException(final ApplicationBusException value) {
- return new JAXBElement<>(_ApplicationBusException_QNAME, ApplicationBusException.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link GetResult }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://opentosca.org/appinvoker/", name = "getResult")
- public JAXBElement createGetResult(final GetResult value) {
- return new JAXBElement<>(_GetResult_QNAME, GetResult.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link InvokeMethodWithServiceInstanceID
- * }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://opentosca.org/appinvoker/", name = "invokeMethodWithServiceInstanceID")
- public JAXBElement createInvokeMethodWithServiceInstanceID(final InvokeMethodWithServiceInstanceID value) {
- return new JAXBElement<>(_InvokeMethodWithServiceInstanceID_QNAME, InvokeMethodWithServiceInstanceID.class,
- null, value);
-
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link IsFinished }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://opentosca.org/appinvoker/", name = "isFinished")
- public JAXBElement createIsFinished(final IsFinished value) {
- return new JAXBElement<>(_IsFinished_QNAME, IsFinished.class, null, value);
- }
-
-}
diff --git a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/model/ParamsMap.java b/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/model/ParamsMap.java
deleted file mode 100644
index eb749c36c..000000000
--- a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/model/ParamsMap.java
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, v2.2.4-2
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.02.25 at 04:54:56 PM CET
-//
-
-
-package org.opentosca.bus.application.api.soaphttp.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- *
- * Java class for ParamsMap complex type.
- *
- *
- * The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="ParamsMap">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="Param" type="{http://opentosca.org/appinvoker/}ParamsMapItemType" maxOccurs="unbounded"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ParamsMap", propOrder = {"param"})
-public class ParamsMap {
-
- @XmlElement(name = "Param", required = true)
- protected List param;
-
- /**
- * Gets the value of the param property.
- *
- *
- * This accessor method returns a reference to the live list, not a snapshot. Therefore any
- * modification you make to the returned list will be present inside the JAXB object. This is why
- * there is not a set method for the param property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- *
- * getParam().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list {@link ParamsMapItemType }
- *
- *
- */
- public List getParam() {
- if (this.param == null) {
- this.param = new ArrayList<>();
- }
- return this.param;
- }
-
-}
diff --git a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/model/ParamsMapItemType.java b/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/model/ParamsMapItemType.java
deleted file mode 100644
index ce8ded5be..000000000
--- a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/model/ParamsMapItemType.java
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, v2.2.4-2
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.02.25 at 04:54:56 PM CET
-//
-
-
-package org.opentosca.bus.application.api.soaphttp.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- *
- * Java class for ParamsMapItemType complex type.
- *
- *
- * The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="ParamsMapItemType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ParamsMapItemType", propOrder = {"key", "value"})
-public class ParamsMapItemType {
-
- @XmlElement(required = true)
- protected String key;
- @XmlElement(required = true)
- protected String value;
-
- /**
- * Gets the value of the key property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getKey() {
- return this.key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setKey(final String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getValue() {
- return this.value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setValue(final String value) {
- this.value = value;
- }
-
-}
diff --git a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/processor/RequestProcessor.java b/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/processor/RequestProcessor.java
deleted file mode 100644
index 8c64ecc94..000000000
--- a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/processor/RequestProcessor.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package org.opentosca.bus.application.api.soaphttp.processor;
-
-import java.util.LinkedHashMap;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.opentosca.bus.application.api.soaphttp.model.GetResult;
-import org.opentosca.bus.application.api.soaphttp.model.InvokeMethodWithNodeInstanceID;
-import org.opentosca.bus.application.api.soaphttp.model.InvokeMethodWithServiceInstanceID;
-import org.opentosca.bus.application.api.soaphttp.model.IsFinished;
-import org.opentosca.bus.application.api.soaphttp.model.ParamsMap;
-import org.opentosca.bus.application.api.soaphttp.model.ParamsMapItemType;
-import org.opentosca.bus.application.model.constants.ApplicationBusConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * RequestProcessor of the Application Bus-SOAP/HTTP-API.
- *
- *
- * This processor handles the incoming requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class RequestProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(RequestProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- String nodeTemplateID = null;
- Integer nodeInstanceID = null;
- Integer serviceInstanceID = null;
- String interfaceName = null;
- String operationName = null;
- ParamsMap paramsMap = null;
- String requestID = null;
-
- final Object request = exchange.getIn().getBody();
-
- if (exchange.getIn().getBody() instanceof InvokeMethodWithServiceInstanceID) {
-
- RequestProcessor.LOG.debug("Processing InvokeMethodWithServiceInstanceID Request");
-
- final InvokeMethodWithServiceInstanceID invoke1Request = (InvokeMethodWithServiceInstanceID) request;
-
- exchange.getIn().setHeader(ApplicationBusConstants.APPLICATION_BUS_METHOD.toString(),
- ApplicationBusConstants.APPLICATION_BUS_METHOD_INVOKE.toString());
-
- serviceInstanceID = invoke1Request.getServiceInstanceID();
- RequestProcessor.LOG.debug("ServiceInstanceID: " + serviceInstanceID);
- exchange.getIn().setHeader(ApplicationBusConstants.SERVICE_INSTANCE_ID_INT.toString(), serviceInstanceID);
-
- nodeTemplateID = invoke1Request.getNodeTemplateID();
- RequestProcessor.LOG.debug("NodeTemplateID: " + nodeTemplateID);
- exchange.getIn().setHeader(ApplicationBusConstants.NODE_TEMPLATE_ID.toString(), nodeTemplateID);
-
- interfaceName = invoke1Request.getInterface();
- RequestProcessor.LOG.debug("InterfaceName: " + interfaceName);
- exchange.getIn().setHeader(ApplicationBusConstants.INTERFACE_NAME.toString(), interfaceName);
-
- operationName = invoke1Request.getOperation();
- RequestProcessor.LOG.debug("NodeTemplateID: " + operationName);
- exchange.getIn().setHeader(ApplicationBusConstants.OPERATION_NAME.toString(), operationName);
-
- paramsMap = invoke1Request.getParams();
-
- exchange.getIn().setBody(getParams(paramsMap));
-
- }
-
- else if (request instanceof InvokeMethodWithNodeInstanceID) {
-
- RequestProcessor.LOG.debug("Processing InvokeMethodWithNodeInstanceID Request");
-
- exchange.getIn().setHeader(ApplicationBusConstants.APPLICATION_BUS_METHOD.toString(),
- ApplicationBusConstants.APPLICATION_BUS_METHOD_INVOKE.toString());
-
- final InvokeMethodWithNodeInstanceID invoke2Request = (InvokeMethodWithNodeInstanceID) request;
-
- nodeInstanceID = invoke2Request.getNodeInstanceID();
- RequestProcessor.LOG.debug("NodeInstanceID: " + nodeInstanceID);
- exchange.getIn().setHeader(ApplicationBusConstants.NODE_INSTANCE_ID_INT.toString(), nodeInstanceID);
-
- interfaceName = invoke2Request.getInterface();
- RequestProcessor.LOG.debug("InterfaceName: " + interfaceName);
- exchange.getIn().setHeader(ApplicationBusConstants.INTERFACE_NAME.toString(), interfaceName);
-
- operationName = invoke2Request.getOperation();
- RequestProcessor.LOG.debug("NodeTemplateID: " + operationName);
- exchange.getIn().setHeader(ApplicationBusConstants.OPERATION_NAME.toString(), operationName);
-
- paramsMap = invoke2Request.getParams();
-
- exchange.getIn().setBody(getParams(paramsMap));
-
- }
-
- else if (exchange.getIn().getBody() instanceof IsFinished) {
-
- RequestProcessor.LOG.debug("Processing IsFinished Request");
-
- exchange.getIn().setHeader(ApplicationBusConstants.APPLICATION_BUS_METHOD.toString(),
- ApplicationBusConstants.APPLICATION_BUS_METHOD_IS_FINISHED.toString());
-
- final IsFinished isFinishedRequest = (IsFinished) request;
-
- requestID = isFinishedRequest.getRequestID();
- RequestProcessor.LOG.debug("RequestID: " + requestID);
-
- exchange.getIn().setBody(requestID);
-
- }
-
- else if (exchange.getIn().getBody() instanceof GetResult) {
-
- RequestProcessor.LOG.debug("Processing GetResult Request");
-
- exchange.getIn().setHeader(ApplicationBusConstants.APPLICATION_BUS_METHOD.toString(),
- ApplicationBusConstants.APPLICATION_BUS_METHOD_GET_RESULT.toString());
-
- final GetResult getResultRequest = (GetResult) request;
-
- requestID = getResultRequest.getRequestID();
- RequestProcessor.LOG.debug("RequestID: " + requestID);
-
- exchange.getIn().setBody(requestID);
-
- }
-
- }
-
- /**
- * @param paramsMap
- * @return LinkedHashMap with keys and values from ParamsMap
- */
- private LinkedHashMap getParams(final ParamsMap paramsMap) {
-
- final LinkedHashMap params = new LinkedHashMap<>();
-
- // put key-value params into camel exchange body as hashmap
- if (paramsMap != null) {
-
- for (final ParamsMapItemType param : paramsMap.getParam()) {
- params.put(param.getKey(), param.getValue());
- }
- }
- return params;
-
- }
-
-}
diff --git a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/processor/ResponseProcessor.java b/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/processor/ResponseProcessor.java
deleted file mode 100644
index 3d936d2c5..000000000
--- a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/processor/ResponseProcessor.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.opentosca.bus.application.api.soaphttp.processor;
-
-import javax.xml.bind.JAXBElement;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.cxf.common.message.CxfConstants;
-import org.opentosca.bus.application.api.soaphttp.model.GetResultResponse;
-import org.opentosca.bus.application.api.soaphttp.model.InvokeMethodWithNodeInstanceIDResponse;
-import org.opentosca.bus.application.api.soaphttp.model.InvokeMethodWithServiceInstanceIDResponse;
-import org.opentosca.bus.application.api.soaphttp.model.IsFinishedResponse;
-import org.opentosca.bus.application.api.soaphttp.model.ObjectFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * ResponseProcessor of the Application Bus-SOAP/HTTP-API.
- *
- *
- * This processor handles the responses back to the caller.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class ResponseProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(ResponseProcessor.class);
-
- private static ObjectFactory objectFactory = new ObjectFactory();
-
- @Override
- public void process(final Exchange exchange) throws Exception {
- ResponseProcessor.LOG.debug("Processing the response...");
-
- if (exchange.getIn().getBody() instanceof Exception) {
- ResponseProcessor.LOG.debug("Exception handling");
-
- final Exception exception = exchange.getIn().getBody(Exception.class);
-
- final org.opentosca.bus.application.api.soaphttp.model.ApplicationBusException e =
- new org.opentosca.bus.application.api.soaphttp.model.ApplicationBusException();
- e.setMessage(exception.getMessage());
-
- final JAXBElement jaxbElement =
- objectFactory.createApplicationBusException(e);
-
- exchange.getIn().setBody(jaxbElement);
-
- return;
- }
-
- final String operation = (String) exchange.getIn().getHeader(CxfConstants.OPERATION_NAME);
-
- if (operation.equals("invokeMethodWithServiceInstanceID")) {
- ResponseProcessor.LOG.debug("Handling invokeMethodWithServiceInstanceID response");
-
- final InvokeMethodWithServiceInstanceIDResponse invokeResponse =
- new InvokeMethodWithServiceInstanceIDResponse();
- invokeResponse.setRequestID(exchange.getIn().getBody(String.class));
-
- final JAXBElement jaxbElement =
- objectFactory.createInvokeMethodWithServiceInstanceIDResponse(invokeResponse);
-
- exchange.getIn().setBody(jaxbElement);
-
- }
-
- if (operation.equals("invokeMethodWithNodeInstanceID")) {
- ResponseProcessor.LOG.debug("Handling invokeMethodWithNodeInstanceID response");
-
- final InvokeMethodWithNodeInstanceIDResponse invokeResponse = new InvokeMethodWithNodeInstanceIDResponse();
- invokeResponse.setRequestID(exchange.getIn().getBody(String.class));
-
- final JAXBElement jaxbElement =
- objectFactory.createInvokeMethodWithNodeInstanceIDResponse(invokeResponse);
-
- exchange.getIn().setBody(jaxbElement);
-
- }
-
- if (operation.equals("isFinished")) {
- ResponseProcessor.LOG.debug("Handling isFinished response");
-
- final IsFinishedResponse isFinishedResponse = new IsFinishedResponse();
- isFinishedResponse.setIsFinished(exchange.getIn().getBody(Boolean.class));
-
- final JAXBElement jaxbElement =
- objectFactory.createIsFinishedResponse(isFinishedResponse);
-
- exchange.getIn().setBody(jaxbElement);
-
- }
-
- if (operation.equals("getResult")) {
- ResponseProcessor.LOG.debug("Handling getResult response");
-
- final GetResultResponse resultResponse = new GetResultResponse();
- resultResponse.setResult(exchange.getIn().getBody());
-
- final JAXBElement jaxbElement = objectFactory.createGetResultResponse(resultResponse);
-
- exchange.getIn().setBody(jaxbElement);
- }
-
- }
-
-}
diff --git a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/route/Route.java b/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/route/Route.java
deleted file mode 100644
index ebbec51c2..000000000
--- a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/route/Route.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.opentosca.bus.application.api.soaphttp.route;
-
-import java.net.URL;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.namespace.QName;
-
-import org.apache.camel.Predicate;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.PredicateBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.ValueBuilder;
-import org.apache.camel.converter.jaxb.JaxbDataFormat;
-import org.opentosca.bus.application.api.soaphttp.processor.RequestProcessor;
-import org.opentosca.bus.application.api.soaphttp.processor.ResponseProcessor;
-import org.opentosca.bus.application.api.soaphttp.servicehandler.ApplicationBusServiceHandler;
-import org.opentosca.bus.application.model.exception.ApplicationBusInternalException;
-
-/**
- * Route of the Application Bus-SOAP/HTTP-API.
- *
- *
- * The endpoint of the SOAP/HTTP-API is created here. Incoming requests will be un/marshalled,
- * routed to processors or the application bus in order to handle the requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Route extends RouteBuilder {
-
- private final static String ENDPOINT = "http://0.0.0.0:8084/appBus";
-
- private final static QName PORT = new QName("http://opentosca.org/appinvoker/", "AppInvokerSoapWebServicePort");
-
-
- @Override
- public void configure() throws Exception {
-
- final URL wsdlURL = this.getClass().getClassLoader().getResource("META-INF/wsdl/SoapAPI.wsdl");
-
- // CXF Endpoint
- final String SOAP_ENDPOINT = "cxf:" + ENDPOINT + "?wsdlURL=" + wsdlURL.toString()
- + "&serviceName={http://opentosca.org/appinvoker/}AppInvokerSoapWebServiceService&portName="
- + Route.PORT.toString() + "&dataFormat=PAYLOAD&loggingFeatureEnabled=true";
-
- final ValueBuilder APP_BUS_ENDPOINT =
- new ValueBuilder(this.method(ApplicationBusServiceHandler.class, "getApplicationBusRoutingEndpoint"));
- final Predicate APP_BUS_ENDPOINT_EXISTS = PredicateBuilder.isNotNull(APP_BUS_ENDPOINT);
-
- final ClassLoader cl = org.opentosca.bus.application.api.soaphttp.model.ObjectFactory.class.getClassLoader();
- final JAXBContext jc = JAXBContext.newInstance("org.opentosca.bus.application.api.soaphttp.model", cl);
- final JaxbDataFormat jaxb = new JaxbDataFormat(jc);
-
- final Processor requestProcessor = new RequestProcessor();
- final Processor responseProcessor = new ResponseProcessor();
-
- this.from(SOAP_ENDPOINT).unmarshal(jaxb).process(requestProcessor).choice().when(APP_BUS_ENDPOINT_EXISTS)
- .recipientList(APP_BUS_ENDPOINT).to("direct:handleResponse").endChoice().otherwise()
- .to("direct:handleException");
-
- // handle exception if Application Bus is not running or wasn't binded
- this.from("direct:handleException")
- .throwException(new ApplicationBusInternalException("It seems like the Application Bus is not running."))
- .to("direct:handleResponse");
-
- // handle response
- this.from("direct:handleResponse").process(responseProcessor).marshal(jaxb);
-
- }
-
-}
diff --git a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/servicehandler/ApplicationBusServiceHandler.java b/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/servicehandler/ApplicationBusServiceHandler.java
deleted file mode 100644
index 02cafd0cc..000000000
--- a/org.opentosca.bus.application.api.soaphttp/src/org/opentosca/bus/application/api/soaphttp/servicehandler/ApplicationBusServiceHandler.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.opentosca.bus.application.api.soaphttp.servicehandler;
-
-import org.opentosca.bus.application.service.IApplicationBusService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Service Handler of the Application Bus-SOAP/HTTP-API.
- *
- *
- * Here the implementation of the IApplicationBusService is binded or unbinded. During the binding
- * the routing endpoint of the Application Bus is handed over.
- *
- *
- * @see IApplicationBusService
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class ApplicationBusServiceHandler {
-
- // Routing endpoint of the IApplicationBus implementation.
- private static String applicationBusRoutingEndpoint = null;
-
- final private static Logger LOG = LoggerFactory.getLogger(ApplicationBusServiceHandler.class);
-
-
- /**
- * @return The Routing endpoint of the ApplicationBus
- */
- public String getApplicationBusRoutingEndpoint() {
-
- return applicationBusRoutingEndpoint;
- }
-
- /**
- * Bind ApplicationBusService
- *
- * @param appBus - The ApplicationBusService to register.
- */
- public void bindApplicationBusService(final IApplicationBusService appBus) {
-
- applicationBusRoutingEndpoint = appBus.getRoutingEndpoint();
-
- ApplicationBusServiceHandler.LOG.debug("Bound ApplicationBusService: {} with Endpoint: {}", appBus.toString(),
- applicationBusRoutingEndpoint);
-
- }
-
- /**
- * Unbind ApplicationBusService.
- *
- * @param appBus - The ApplicationBusService to unregister.
- */
- public void unbindApplicationBusService(final IApplicationBusService appBus) {
- ApplicationBusServiceHandler.LOG.debug("Unbind ApplicationBusService: {} with Endpoint: {}", appBus.toString(),
- applicationBusRoutingEndpoint);
- applicationBusRoutingEndpoint = null;
- }
-}
diff --git a/org.opentosca.bus.application.model/META-INF/MANIFEST.MF b/org.opentosca.bus.application.model/META-INF/MANIFEST.MF
deleted file mode 100644
index b602d2fdd..000000000
--- a/org.opentosca.bus.application.model/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Model bundle of Application Bus
-Bundle-SymbolicName: org.opentosca.bus.application.model
-Bundle-Version: 2.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.opentosca.bus.application.model.constants,
- org.opentosca.bus.application.model.exception
diff --git a/org.opentosca.bus.application.model/build.properties b/org.opentosca.bus.application.model/build.properties
deleted file mode 100644
index a12d47e56..000000000
--- a/org.opentosca.bus.application.model/build.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .
diff --git a/org.opentosca.bus.application.model/pom.xml b/org.opentosca.bus.application.model/pom.xml
deleted file mode 100644
index 897ced6cc..000000000
--- a/org.opentosca.bus.application.model/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.application.model
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/META-INF/MANIFEST.MF b/org.opentosca.bus.application.plugin.jsonhttp.service.impl/META-INF/MANIFEST.MF
deleted file mode 100644
index 8e40e3025..000000000
--- a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,21 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Json Http Plugin of the Application Bus
-Bundle-SymbolicName: org.opentosca.bus.application.plugin.jsonhttp.service.impl
-Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.opentosca.bus.application.plugin.jsonhttp.service.impl.Activator
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.apache.camel;version="2.10.4",
- org.apache.camel.builder;version="2.10.4",
- org.apache.camel.component.cxf.common.message;version="2.10.4",
- org.apache.camel.core.osgi;version="2.10.4",
- org.apache.camel.impl;version="2.10.4",
- org.apache.camel.model;version="2.10.4",
- org.apache.camel.spi;version="2.10.4",
- org.json.simple,
- org.osgi.framework;version="1.6.0",
- org.slf4j;version="1.7.5"
-Require-Bundle: org.opentosca.bus.application.model;bundle-version="1.0.0",
- org.opentosca.bus.application.plugin.service;bundle-version="1.0.0"
-Service-Component: OSGI-INF/*
-Bundle-ActivationPolicy: lazy
diff --git a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/OSGI-INF/ApplicationBusJsonHttpPluginServiceImpl_component.xml b/org.opentosca.bus.application.plugin.jsonhttp.service.impl/OSGI-INF/ApplicationBusJsonHttpPluginServiceImpl_component.xml
deleted file mode 100644
index 1e6059c84..000000000
--- a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/OSGI-INF/ApplicationBusJsonHttpPluginServiceImpl_component.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/build.properties b/org.opentosca.bus.application.plugin.jsonhttp.service.impl/build.properties
deleted file mode 100644
index 686be4f32..000000000
--- a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
diff --git a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/pom.xml b/org.opentosca.bus.application.plugin.jsonhttp.service.impl/pom.xml
deleted file mode 100644
index 1422b1dbc..000000000
--- a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.application.plugin.jsonhttp.service.impl
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/Activator.java b/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/Activator.java
deleted file mode 100644
index fe5d681c1..000000000
--- a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/Activator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.opentosca.bus.application.plugin.jsonhttp.service.impl;
-
-import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
-import org.apache.camel.core.osgi.OsgiServiceRegistry;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.opentosca.bus.application.plugin.jsonhttp.service.impl.route.Route;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Activator of the JSON/HTTP-Application Bus-Plugin.
- *
- *
- * The activator is needed to add and start the camel routes. The bundleID is used for generating
- * the routing endpoint of this plugin.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Activator implements BundleActivator {
-
- final private static Logger LOG = LoggerFactory.getLogger(Activator.class);
-
- private static DefaultCamelContext camelContext;
-
- private static String bundleID;
-
- static String getBundleID() {
- return bundleID;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework. BundleContext)
- */
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
-
- bundleID = bundleContext.getBundle().getSymbolicName();
-
- camelContext = new OsgiDefaultCamelContext(bundleContext);
-
- camelContext.addRoutes(new Route());
-
- camelContext.start();
- Activator.LOG.info("Application Bus JSON-HTTP plugin started!");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(final BundleContext bundleContext) throws Exception {
- Activator.camelContext = null;
- Activator.LOG.info("Application Bus JSON-HTTP plugin stopped!");
- }
-
-}
diff --git a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/processor/RequestProcessor.java b/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/processor/RequestProcessor.java
deleted file mode 100644
index cff5d4c4f..000000000
--- a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/processor/RequestProcessor.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.opentosca.bus.application.plugin.jsonhttp.service.impl.processor;
-
-import java.util.LinkedHashMap;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONValue;
-import org.opentosca.bus.application.model.constants.ApplicationBusConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * RequestProcessor of the Application Bus-JSON/HTTP-Plugin.
- *
- *
- * This processor handles the incoming requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class RequestProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(RequestProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- RequestProcessor.LOG.debug("Creation of the json request body...");
-
- final String className =
- exchange.getIn().getHeader(ApplicationBusConstants.CLASS_NAME.toString(), String.class);
- final String operationName =
- exchange.getIn().getHeader(ApplicationBusConstants.OPERATION_NAME.toString(), String.class);
-
- final LinkedHashMap params = exchange.getIn().getBody(LinkedHashMap.class);
-
- // JSON body creation
- final JSONObject infoJSON = new JSONObject();
- infoJSON.put("class", className);
- infoJSON.put("operation", operationName);
-
- final LinkedHashMap finalJSON = new LinkedHashMap<>();
- finalJSON.put("invocation-information", infoJSON);
- if (params != null) {
- finalJSON.put("params", params);
- }
-
- final String finalJSONString = JSONValue.toJSONString(finalJSON);
-
- RequestProcessor.LOG.debug("Created json request body: {}", finalJSONString);
-
- exchange.getIn().setBody(finalJSONString);
-
- }
-
-}
diff --git a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/processor/ResponseProcessor.java b/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/processor/ResponseProcessor.java
deleted file mode 100644
index 5172e8ccf..000000000
--- a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/processor/ResponseProcessor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.opentosca.bus.application.plugin.jsonhttp.service.impl.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONValue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * ResponseProcessor of the Application Bus-JSON/HTTP-Plugin.
- *
- *
- * This processor handles the responses.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class ResponseProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(ResponseProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- ResponseProcessor.LOG.debug("Parsing the response...");
-
- final String response = exchange.getIn().getBody(String.class);
-
- final JSONObject obj = (JSONObject) JSONValue.parse(response);
- final Object result = obj.get("result");
-
- ResponseProcessor.LOG.debug("Response: {}", result);
-
- exchange.getIn().setBody(result);
-
- }
-
-}
diff --git a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/route/Route.java b/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/route/Route.java
deleted file mode 100644
index a45715e59..000000000
--- a/org.opentosca.bus.application.plugin.jsonhttp.service.impl/src/org/opentosca/bus/application/plugin/jsonhttp/service/impl/route/Route.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.opentosca.bus.application.plugin.jsonhttp.service.impl.route;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Predicate;
-import org.apache.camel.builder.PredicateBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.builder.SimpleBuilder;
-import org.opentosca.bus.application.model.constants.ApplicationBusConstants;
-import org.opentosca.bus.application.model.exception.ApplicationBusExternalException;
-import org.opentosca.bus.application.plugin.jsonhttp.service.impl.ApplicationBusJsonHttpPluginServiceImpl;
-import org.opentosca.bus.application.plugin.jsonhttp.service.impl.processor.RequestProcessor;
-import org.opentosca.bus.application.plugin.jsonhttp.service.impl.processor.ResponseProcessor;
-
-/**
- * Route of the Application Bus-JSON/HTTP-Plugin.
- *
- *
- * The endpoint of the JSON/HTTP-Plugin is created here. The Application Bus uses this endpoint to
- * send the needed information to invoke an application. The request and response processing as well
- * as the invocation itself are also handled in this route.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Route extends RouteBuilder {
-
- private static final String APPINVOKER_ENDPOINT_SUFFIX = "/OTABProxy/v1/appInvoker";
-
- // returning json string indicating that the invocation is not finished yet
- private static final String PENDING_STRING = "{\"status\":\"PENDING\"}";
-
- // dummy endpoint; will be overwritten by HTTP_URI header
- private static final String DUMMY_ENDPOINT = "http://dummyhost?throwExceptionOnFailure=false";
-
- @Override
- public void configure() throws Exception {
-
- final Predicate OK = header(Exchange.HTTP_RESPONSE_CODE).isEqualTo(200);
- final Predicate PENDING = PredicateBuilder.and(OK, body().isEqualTo(PENDING_STRING));
- final Predicate RESULT_RECEIVED = PredicateBuilder.and(OK, PredicateBuilder.not(PENDING));
-
- final SimpleBuilder INVOKE_ENDPOINT = simple("${header."
- + ApplicationBusConstants.INVOCATION_ENDPOINT_URL.toString() + "}" + APPINVOKER_ENDPOINT_SUFFIX);
- final SimpleBuilder POLL_ENDPOINT = simple("${header.Location}");
-
- final RequestProcessor requestProcessor = new RequestProcessor();
- final ResponseProcessor responseProcessor = new ResponseProcessor();
-
- from(ApplicationBusJsonHttpPluginServiceImpl.ENDPOINT).process(requestProcessor)
- .setHeader(Exchange.HTTP_METHOD, constant("POST"))
- .setHeader(Exchange.CONTENT_TYPE,
- constant("application/json"))
- .setHeader(Exchange.HTTP_URI, INVOKE_ENDPOINT)
- .to(DUMMY_ENDPOINT).choice()
- .when(header(Exchange.HTTP_RESPONSE_CODE).isEqualTo(202))
- .setHeader(Exchange.HTTP_URI, POLL_ENDPOINT)
- .to("direct:polling").endChoice().otherwise()
- .to("direct:throwException");
-
- from("direct:polling").setHeader(Exchange.HTTP_METHOD, constant("GET")).to(DUMMY_ENDPOINT)
- .convertBodyTo(String.class).choice().when(PENDING).delay(5000).to("direct:polling")
- .endChoice().when(RESULT_RECEIVED).process(responseProcessor).endChoice().otherwise()
- .to("direct:throwException");
-
- from("direct:throwException").process(exchange -> exchange.getIn().setBody(new ApplicationBusExternalException(
- exchange.getIn().getBody(String.class))));
-
- }
-
-}
diff --git a/org.opentosca.bus.application.plugin.service/META-INF/MANIFEST.MF b/org.opentosca.bus.application.plugin.service/META-INF/MANIFEST.MF
deleted file mode 100644
index 7275e953a..000000000
--- a/org.opentosca.bus.application.plugin.service/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,9 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Interface for the Application Bus Plugins
-Bundle-SymbolicName: org.opentosca.bus.application.plugin.service
-Bundle-Version: 2.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.apache.camel;version="2.10.4"
-Export-Package: org.opentosca.bus.application.plugin.service
-Require-Bundle: org.opentosca.bus.application.model;bundle-version="1.0.0"
diff --git a/org.opentosca.bus.application.plugin.service/build.properties b/org.opentosca.bus.application.plugin.service/build.properties
deleted file mode 100644
index a12d47e56..000000000
--- a/org.opentosca.bus.application.plugin.service/build.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .
diff --git a/org.opentosca.bus.application.plugin.service/pom.xml b/org.opentosca.bus.application.plugin.service/pom.xml
deleted file mode 100644
index fb981824a..000000000
--- a/org.opentosca.bus.application.plugin.service/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.application.plugin.service
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/META-INF/MANIFEST.MF b/org.opentosca.bus.application.plugin.soaphttp.service.impl/META-INF/MANIFEST.MF
deleted file mode 100644
index f3f57eaab..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,31 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.opentosca.bus.application.plugin.soaphttp.service.impl
-Bundle-SymbolicName: org.opentosca.bus.application.plugin.soaphttp.service.impl
-Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.opentosca.bus.application.plugin.soaphttp.service.impl.Activator
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Import-Package: com.predic8.schema;version="1.2.2",
- com.predic8.soamodel;version="1.2.2",
- com.predic8.wsdl;version="1.2.2",
- com.predic8.wstool.creator;version="1.2.2",
- groovy.xml;version="1.8.6",
- org.apache.camel;version="2.10.4",
- org.apache.camel.builder;version="2.10.4",
- org.apache.camel.component.cxf;version="2.10.4",
- org.apache.camel.component.direct;version="2.10.4",
- org.apache.camel.component.jetty;version="2.10.4",
- org.apache.camel.core.osgi;version="2.10.4",
- org.apache.camel.impl;version="2.10.4",
- org.apache.camel.model;version="2.10.4",
- org.apache.cxf.binding.soap;version="2.7.3",
- org.apache.cxf.headers;version="2.7.3",
- org.apache.cxf.helpers;version="2.7.3",
- org.eclipse.osgi.util;version="1.1.0",
- org.opentosca.bus.application.model.constants,
- org.opentosca.bus.application.plugin.service,
- org.opentosca.settings,
- org.osgi.framework;version="1.3.0",
- org.slf4j;version="1.7.5"
-Service-Component: OSGI-INF/ApplicationBusPluginSoapHttpServiceImpl - component.xml
-Require-Bundle: org.eclipse.equinox.ds;bundle-version="1.3.1"
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/OSGI-INF/ApplicationBusPluginSoapHttpServiceImpl - component.xml b/org.opentosca.bus.application.plugin.soaphttp.service.impl/OSGI-INF/ApplicationBusPluginSoapHttpServiceImpl - component.xml
deleted file mode 100644
index 1981c68e5..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/OSGI-INF/ApplicationBusPluginSoapHttpServiceImpl - component.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/build.properties b/org.opentosca.bus.application.plugin.soaphttp.service.impl/build.properties
deleted file mode 100644
index 4ab6e2638..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
-source.. = src/
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/pom.xml b/org.opentosca.bus.application.plugin.soaphttp.service.impl/pom.xml
deleted file mode 100644
index 4f18d6ead..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.application.plugin.soaphttp.service.impl
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/Activator.java b/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/Activator.java
deleted file mode 100644
index 707200e7a..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/Activator.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.opentosca.bus.application.plugin.soaphttp.service.impl;
-
-import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.opentosca.bus.application.plugin.soaphttp.service.impl.route.Route;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Activator of the SOAP/HTTP-Application Bus-Plug-in.
- *
- *
- *
- * The activator is needed to add and start the camel routes. The bundleID is
- * used for generating the routing endpoint of this plugin.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class Activator implements BundleActivator {
-
-
- final private static Logger LOG = LoggerFactory.getLogger(Activator.class);
-
- public static DefaultCamelContext camelContext;
-
- private static String bundleID;
-
-
- static String getBundleID() {
- return Activator.bundleID;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
- * )
- */
- @Override
- public void start(BundleContext bundleContext) throws Exception {
-
- Activator.bundleID = bundleContext.getBundle().getSymbolicName();
-
- Activator.camelContext = new OsgiDefaultCamelContext(bundleContext);
- Activator.camelContext.addRoutes(new Route());
- Activator.camelContext.start();
- Activator.LOG.info("Application Bus-SOAP-PLUGIN-STARTED");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.camelContext = null;
- Activator.LOG.info("Application Bus-SOAP-PLUGIN-stopped");
- }
-
-}
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/ApplicationBusPluginSoapHttpServiceImpl.java b/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/ApplicationBusPluginSoapHttpServiceImpl.java
deleted file mode 100644
index b0067442f..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/ApplicationBusPluginSoapHttpServiceImpl.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.opentosca.bus.application.plugin.soaphttp.service.impl;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.opentosca.bus.application.plugin.service.IApplicationBusPluginService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Application Bus-Plug-in for invoking a service with a SOAP message over HTTP.
- *
- *
- * The Plug-in gets needed information (like endpoint of the service or
- * operation to invoke) from the Application Bus and creates a SOAP message out
- * of it. If needed the Plug-in parses the WSDL of the service. The Plug-in
- * supports synchronous request-response communication, asynchronous
- * communication with callbacks and one-way invocation.
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- */
-public class ApplicationBusPluginSoapHttpServiceImpl implements IApplicationBusPluginService {
-
-
- final private static Logger LOG = LoggerFactory.getLogger(ApplicationBusPluginSoapHttpServiceImpl.class);
-
- // Supported types defined in messages.properties.
- private static final List invocationTypes = Arrays.asList("SOAP/HTTP");
-
- // Routing endpoint of the Application Bus bundle
- public static final String ENDPOINT = "direct-vm:" + Activator.getBundleID();
-
-
- @Override
- public List getSupportedInvocationTypes() {
- ApplicationBusPluginSoapHttpServiceImpl.LOG.debug("Supported Types: {}.", ApplicationBusPluginSoapHttpServiceImpl.invocationTypes);
-
- return ApplicationBusPluginSoapHttpServiceImpl.invocationTypes;
- }
-
- @Override
- public String getRoutingEndpoint() {
- return ApplicationBusPluginSoapHttpServiceImpl.ENDPOINT;
- }
-}
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/AsyncProcessor.java b/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/AsyncProcessor.java
deleted file mode 100644
index d52f6c992..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/AsyncProcessor.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package org.opentosca.bus.application.plugin.soaphttp.service.impl.processor;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.camel.ConsumerTemplate;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-import org.apache.camel.ProducerTemplate;
-import org.opentosca.bus.application.plugin.soaphttp.service.impl.Activator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.traversal.DocumentTraversal;
-import org.w3c.dom.traversal.NodeFilter;
-import org.w3c.dom.traversal.NodeIterator;
-
-/**
- * Async-Processor of the Application Bus-SOAP/HTTP-Plug-in.
- *
- * This processor manages the sending of the invocation message and matches
- * incoming callback messages.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class AsyncProcessor implements Processor {
-
-
- final private static Logger LOG = LoggerFactory.getLogger(AsyncProcessor.class);
-
- private static Map exchangeMap = Collections.synchronizedMap(new HashMap());
-
-
- @Override
- public void process(Exchange exchange) throws Exception {
-
- AsyncProcessor.LOG.debug("Invoking the web service.");
-
- ProducerTemplate template = Activator.camelContext.createProducerTemplate();
-
- ConsumerTemplate consumer = Activator.camelContext.createConsumerTemplate();
-
- Document response = null;
-
- String messageID = exchange.getIn().getMessageId();
-
- AsyncProcessor.LOG.debug("Storing exchange message with MessageID: {}", messageID);
-
- AsyncProcessor.exchangeMap.put(messageID, exchange);
-
- template.sendBody("direct:Invoke", exchange.getIn().getBody());
-
- Exchange ex = null;
-
- while (response == null) {
-
- try {
-
- consumer.start();
- ex = consumer.receive("direct:Callback" + messageID);
- consumer.stop();
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- Message mes = ex.getIn();
-
- AsyncProcessor.LOG.debug("Got Message with ID: {}", messageID);
- AsyncProcessor.LOG.debug("Stored MessageIDs: {}", AsyncProcessor.exchangeMap.keySet().toString());
-
- if (AsyncProcessor.exchangeMap.containsKey(messageID)) {
- AsyncProcessor.LOG.debug("MessageID found");
- exchange = AsyncProcessor.exchangeMap.get(messageID);
-
- response = mes.getBody(Document.class);
- AsyncProcessor.exchangeMap.remove(messageID);
- }
- }
-
- AsyncProcessor.LOG.debug("Transforming Document to HashMap...");
-
- HashMap responseMap = AsyncProcessor.docToMap(response, false);
-
- exchange.getIn().setBody(responseMap);
-
- AsyncProcessor.LOG.debug("Returning exchange with MessageID: {}", exchange.getIn().getMessageId());
- AsyncProcessor.LOG.debug("Returning body: {}", exchange.getIn().getBody().toString());
-
- }
-
- /**
- * Transfers s document to a map.
- *
- * @param document to be transfered to a map.
- * @return transfered map.
- */
- public static HashMap docToMap(Document document, boolean allowEmptyEntries) {
- HashMap reponseMap = new HashMap();
-
- DocumentTraversal traversal = (DocumentTraversal) document;
- NodeIterator iterator = traversal.createNodeIterator(document.getDocumentElement(), NodeFilter.SHOW_ELEMENT, null, true);
-
- for (Node node = iterator.nextNode(); node != null; node = iterator.nextNode()) {
-
- String name = ((Element) node).getLocalName();
- StringBuilder content = new StringBuilder();
- NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
- if (child.getNodeType() == Node.TEXT_NODE) {
- content.append(child.getTextContent());
- }
- }
-
- if (allowEmptyEntries) {
- reponseMap.put(name, content.toString());
- } else {
- if (!content.toString().trim().isEmpty()) {
- reponseMap.put(name, content.toString());
- }
- }
-
- }
-
- return reponseMap;
- }
-
- /**
- * @return the keys of the map containing stored messageIds and exchange
- * objects.
- */
- public static Set getMessageIDs() {
- return AsyncProcessor.exchangeMap.keySet();
- }
-}
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/CallbackProcessor.java b/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/CallbackProcessor.java
deleted file mode 100644
index aaa9f2124..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/CallbackProcessor.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.opentosca.bus.application.plugin.soaphttp.service.impl.processor;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.cxf.binding.soap.SoapHeader;
-import org.apache.cxf.headers.Header;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Callback-Processor of the Application Bus-SOAP/HTTP-Plug-in.
- *
- * This processor processes incoming soap messages. It checks if the messages
- * are containing existing messageIDs.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class CallbackProcessor implements Processor {
-
-
- final private static Logger LOG = LoggerFactory.getLogger(CallbackProcessor.class);
-
-
- @Override
- public void process(Exchange exchange) throws Exception {
-
- Set messageIDs = AsyncProcessor.getMessageIDs();
-
- CallbackProcessor.LOG.debug("Stored messageIDs: {}", messageIDs.toString());
-
- // copy SOAP headers in camel exchange header
- @SuppressWarnings("unchecked")
- List soapHeaders = (List) exchange.getIn().getHeader(Header.HEADER_LIST);
- Element element;
- if (soapHeaders != null) {
- for (SoapHeader header : soapHeaders) {
- element = (Element) header.getObject();
- exchange.getIn().setHeader(element.getLocalName(), element.getTextContent());
- }
- }
-
- String message = exchange.getIn().getBody(String.class);
- Map headers = exchange.getIn().getHeaders();
-
- CallbackProcessor.LOG.debug("Searching the callback Message for a MessageID matching the stored ones...");
-
- for (String messageID : messageIDs) {
-
- // checks if the callback message contains a stored messageID
- if (message.matches("(?s).*\\s*[^a-zA-Z0-9-]" + messageID + "[^a-zA-Z0-9-]\\s*(?s).*") || headers.containsValue(messageID)) {
-
- CallbackProcessor.LOG.debug("Found MessageID: {}", messageID);
-
- MessageFactory messageFactory = MessageFactory.newInstance();
-
- InputStream inputStream = new ByteArrayInputStream(message.getBytes("UTF-8"));
- SOAPMessage soapMessage = messageFactory.createMessage(null, inputStream);
-
- exchange.getIn().setHeader("MessageID", messageID);
- exchange.getIn().setHeader("AvailableMessageID", "true");
-
- Document doc;
-
- try {
- doc = soapMessage.getSOAPBody().extractContentAsDocument();
- exchange.getIn().setBody(doc);
-
- } catch (SOAPException e) {
-
- doc = soapMessage.getSOAPPart().getEnvelope().getOwnerDocument();
-
- CallbackProcessor.LOG.warn("SOAP response body can't be parsed and/or isn't well formatted. Returning alternative response.");
- exchange.getIn().setBody(doc);
- }
-
- break;
-
- }
- }
-
- }
-}
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/HeaderProcessor.java b/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/HeaderProcessor.java
deleted file mode 100644
index bb546ab1a..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/HeaderProcessor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.opentosca.bus.application.plugin.soaphttp.service.impl.processor;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.cxf.CxfPayload;
-import org.apache.cxf.binding.soap.SoapHeader;
-import org.apache.cxf.helpers.DOMUtils;
-import org.xml.sax.SAXException;
-
-/**
- * Header-Processor of the Application Bus-SOAP/HTTP-Plug-in.
- *
- * This processor copies all self defined header of the exchange object into
- * SoapHeader of the outgoing Soap message.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class HeaderProcessor implements Processor {
-
-
- @Override
- public void process(Exchange exchange) throws Exception {
-
- @SuppressWarnings("unchecked")
- CxfPayload payload = exchange.getIn().getBody(CxfPayload.class);
-
- Map headers = exchange.getIn().getHeaders();
- for (Map.Entry entry : headers.entrySet()) {
-
- if (entry.getKey().equalsIgnoreCase("ReplyTo")) {
-
- String xml1 = "" + entry.getValue().toString() + "";
- SoapHeader replyToSoapHeader = new SoapHeader(new QName("http://www.w3.org/2005/08/addressing", "ReplyTo"), DOMUtils.readXml(new StringReader(xml1)).getDocumentElement());
- payload.getHeaders().add(replyToSoapHeader);
-
- } else if (entry.getKey().equalsIgnoreCase("MessageID")) {
-
- String xml2 = "" + entry.getValue().toString() + "";
- SoapHeader messageIdSoapHeader = new SoapHeader(new QName("http://www.w3.org/2005/08/addressing", "MessageID"), DOMUtils.readXml(new StringReader(xml2)).getDocumentElement());
- payload.getHeaders().add(messageIdSoapHeader);
-
- } else {
-
- payload.getHeaders().add(this.getSoapHeader(entry.getKey(), entry.getValue().toString()));
-
- }
- }
-
- exchange.getIn().setBody(payload);
-
- }
-
- /**
- * Returns a SoapHeader
- *
- * @param key of the header
- * @param content of the header
- * @return SoapHeader
- */
- private SoapHeader getSoapHeader(String key, String content) {
- String xml = "<" + key + ">" + content + "" + key + ">";
- try {
- return new SoapHeader(new QName(key), DOMUtils.readXml(new StringReader(xml)).getDocumentElement());
- } catch (SAXException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ParserConfigurationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
-
- }
-
-}
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/RequestProcessor.java b/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/RequestProcessor.java
deleted file mode 100644
index 5fa19663e..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/processor/RequestProcessor.java
+++ /dev/null
@@ -1,191 +0,0 @@
-package org.opentosca.bus.application.plugin.soaphttp.service.impl.processor;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-import org.opentosca.bus.application.model.constants.ApplicationBusConstants;
-import org.opentosca.bus.application.plugin.soaphttp.service.impl.route.Route;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import com.predic8.wsdl.Binding;
-import com.predic8.wsdl.BindingOperation;
-import com.predic8.wsdl.Definitions;
-import com.predic8.wsdl.WSDLParser;
-
-/**
- * RequestProcessor of the Application Bus-SOAP/HTTP-Plugin.
- *
- *
- * This processor handles the incoming requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class RequestProcessor implements Processor {
-
-
- final private static Logger LOG = LoggerFactory.getLogger(RequestProcessor.class);
-
-
- @Override
- public void process(Exchange exchange) throws Exception {
-
- RequestProcessor.LOG.debug("Creation of the SOAP request body...");
-
- Message message = exchange.getIn();
-
- Object params = message.getBody();
- String operationName = message.getHeader(ApplicationBusConstants.OPERATION_NAME.toString(), String.class);
- String endpoint = message.getHeader(ApplicationBusConstants.INVOCATION_ENDPOINT_URL.toString(), String.class);
-
- if (!endpoint.endsWith("?wsdl")) {
- endpoint = endpoint.concat("?wsdl");
- }
-
- Map headers = new HashMap();
-
- headers.put("endpoint", endpoint.replace("?wsdl", ""));
- headers.put("MessageID", message.getMessageId());
- headers.put("ReplyTo", Route.CALLBACKADDRESS);
-
- message.setHeaders(headers);
-
- boolean foundFlag = false;
-
- Document document = null;
-
- if (params instanceof HashMap) {
-
- String rootElementNamespaceURI = null;
- String rootElementName = null;
-
- @SuppressWarnings("unchecked")
- HashMap paramsMap = (HashMap) params;
-
- WSDLParser parser = new WSDLParser();
-
- RequestProcessor.LOG.info("Parsing WSDL at: {}.", endpoint);
-
- Definitions wsdl;
-
- // If wsdl is not accessible, try again (max wait 5 min)
- int count = 0;
- int maxTries = 30;
- while (true) {
- try {
- wsdl = parser.parse(endpoint.toString());
- break;
- } catch (Exception e) {
- // handle exception
- if (++count == maxTries) {
- RequestProcessor.LOG.error("Unable to access the wsdl at: {}.", endpoint);
- throw e;
- } else {
- RequestProcessor.LOG.warn("Problem accessing the wsdl at: {}. Retry... ({}/{})", endpoint, count, maxTries);
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
- }
- }
- }
-
- // Jump-Label to stop both loops at once
- searchOperation: for (Binding bind : wsdl.getBindings()) {
-
- RequestProcessor.LOG.debug("Binding: {}", bind);
-
- if (bind.getProtocol().toString().toLowerCase().contains("soap")) {
-
- for (BindingOperation op : bind.getOperations()) {
- RequestProcessor.LOG.debug("Operation: {} =? {}", op.getName(), operationName);
-
- if (op.getName().equals(operationName)) {
- String portType = bind.getPortType().getName();
- RequestProcessor.LOG.debug("PortType: {}", portType);
- String rootElementWithPrefix = wsdl.getElementNameForOperation(operationName, portType);
- com.predic8.schema.Element element = wsdl.getElementForOperation(operationName, portType);
- rootElementName = element.getName();
- rootElementNamespaceURI = (String) element.getNamespace(rootElementWithPrefix.replace(":" + rootElementName, ""));
- RequestProcessor.LOG.debug("Root ElementName: {} with NamespaceURI: {}", rootElementName, rootElementNamespaceURI);
-
- foundFlag = true;
-
- break searchOperation;
- }
- }
- }
- }
-
- if (foundFlag == false) {
- RequestProcessor.LOG.error("No invokable operation found. Invocation aborted!");
- }
-
- document = this.mapToDoc(rootElementNamespaceURI, rootElementName, paramsMap);
-
- }
-
- if (params instanceof Document) {
-
- document = (Document) params;
- }
-
- RequestProcessor.LOG.debug("Created SOAP request body: {}", document);
-
- exchange.getIn().setBody(document);
-
- }
-
- /**
- * Transfers the paramsMap into a Document.
- *
- * @param rootElementNamespaceURI
- * @param rootElementName
- * @param paramsMap
- *
- * @return the created Document.
- */
- private Document mapToDoc(String rootElementNamespaceURI, String rootElementName, HashMap paramsMap) {
-
- Document document;
-
- DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder documentBuilder = null;
- try {
- documentBuilder = documentBuilderFactory.newDocumentBuilder();
- } catch (ParserConfigurationException e) {
- RequestProcessor.LOG.error("Some error occured.");
- e.printStackTrace();
- }
-
- document = documentBuilder.newDocument();
-
- Element rootElement = document.createElementNS(rootElementNamespaceURI, rootElementName);
- document.appendChild(rootElement);
-
- Element mapElement;
- for (Entry entry : paramsMap.entrySet()) {
- mapElement = document.createElement(entry.getKey());
- mapElement.setTextContent(entry.getValue());
- rootElement.appendChild(mapElement);
-
- }
-
- return document;
- }
-
-}
diff --git a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/route/Route.java b/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/route/Route.java
deleted file mode 100644
index 93efe41a3..000000000
--- a/org.opentosca.bus.application.plugin.soaphttp.service.impl/src/org/opentosca/bus/application/plugin/soaphttp/service/impl/route/Route.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.opentosca.bus.application.plugin.soaphttp.service.impl.route;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.opentosca.bus.application.plugin.soaphttp.service.impl.ApplicationBusPluginSoapHttpServiceImpl;
-import org.opentosca.bus.application.plugin.soaphttp.service.impl.processor.AsyncProcessor;
-import org.opentosca.bus.application.plugin.soaphttp.service.impl.processor.CallbackProcessor;
-import org.opentosca.bus.application.plugin.soaphttp.service.impl.processor.HeaderProcessor;
-import org.opentosca.bus.application.plugin.soaphttp.service.impl.processor.RequestProcessor;
-import org.opentosca.settings.Settings;
-
-/**
- * Route of the Application Bus-SOAP/HTTP-Plugin.
- *
- *
- * The endpoint of the SOAP/HTTP-Plugin is created here. The Application Bus
- * uses this endpoint to send the needed information to invoke an application.
- * The request and response processing as well as the invocation itself are also
- * handled in this route.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Route extends RouteBuilder {
-
-
- public final static String CALLBACKADDRESS = "http://"+ Settings.OPENTOSCA_CONTAINER_HOSTNAME +":8099/callback";
-
-
- @Override
- public void configure() throws Exception {
-
- final String ENDPOINT = "cxf:${header[endpoint]}?dataFormat=PAYLOAD&loggingFeatureEnabled=true";
-
- RequestProcessor requestProcessor = new RequestProcessor();
- CallbackProcessor callbackProcessor = new CallbackProcessor();
- AsyncProcessor asyncProcessor = new AsyncProcessor();
- HeaderProcessor headeProcessor = new HeaderProcessor();
-
- this.from(ApplicationBusPluginSoapHttpServiceImpl.ENDPOINT).process(requestProcessor).process(asyncProcessor).end();
-
- this.from("direct:Invoke").process(headeProcessor).recipientList(this.simple(ENDPOINT)).end();
-
- this.from("jetty:" + Route.CALLBACKADDRESS).process(callbackProcessor).choice().when(this.header("AvailableMessageID").isEqualTo("true")).recipientList(this.simple("direct:Callback${header.MessageID}")).end();
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/META-INF/MANIFEST.MF b/org.opentosca.bus.application.service.impl/META-INF/MANIFEST.MF
deleted file mode 100644
index 60fec74ea..000000000
--- a/org.opentosca.bus.application.service.impl/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Application Bus Service Impl
-Bundle-SymbolicName: org.opentosca.bus.application.service.impl
-Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.opentosca.bus.application.service.impl.Activator
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.apache.camel;version="2.10.4",
- org.apache.camel.builder;version="2.10.4",
- org.apache.camel.component.directvm;version="2.10.4",
- org.apache.camel.core.osgi;version="2.10.4",
- org.apache.camel.impl;version="2.10.4",
- org.apache.camel.model;version="2.10.4",
- org.apache.camel.spi;version="2.10.4",
- org.osgi.framework;version="1.6.0",
- org.slf4j;version="1.6.4"
-Require-Bundle: org.opentosca.container.core;bundle-version="1.0.0",
- org.opentosca.container.core.tosca;bundle-version="1.0.0",
- org.opentosca.bus.application.model;bundle-version="1.0.0",
- org.opentosca.bus.application.service;bundle-version="1.0.0",
- org.opentosca.bus.application.plugin.service;bundle-version="1.0.0"
-Service-Component: OSGI-INF/*
-Bundle-ActivationPolicy: lazy
diff --git a/org.opentosca.bus.application.service.impl/OSGI-INF/ApplicationBusPluginServiceHandler_component.xml b/org.opentosca.bus.application.service.impl/OSGI-INF/ApplicationBusPluginServiceHandler_component.xml
deleted file mode 100644
index cda128e4c..000000000
--- a/org.opentosca.bus.application.service.impl/OSGI-INF/ApplicationBusPluginServiceHandler_component.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/org.opentosca.bus.application.service.impl/OSGI-INF/ApplicationBusServiceImpl_component.xml b/org.opentosca.bus.application.service.impl/OSGI-INF/ApplicationBusServiceImpl_component.xml
deleted file mode 100644
index 2f428e626..000000000
--- a/org.opentosca.bus.application.service.impl/OSGI-INF/ApplicationBusServiceImpl_component.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/org.opentosca.bus.application.service.impl/OSGI-INF/InstanceDataServiceHandler_component.xml b/org.opentosca.bus.application.service.impl/OSGI-INF/InstanceDataServiceHandler_component.xml
deleted file mode 100644
index a42c02926..000000000
--- a/org.opentosca.bus.application.service.impl/OSGI-INF/InstanceDataServiceHandler_component.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/org.opentosca.bus.application.service.impl/OSGI-INF/ToscaServiceHandler_component.xml b/org.opentosca.bus.application.service.impl/OSGI-INF/ToscaServiceHandler_component.xml
deleted file mode 100644
index 9bf5829c5..000000000
--- a/org.opentosca.bus.application.service.impl/OSGI-INF/ToscaServiceHandler_component.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/org.opentosca.bus.application.service.impl/build.properties b/org.opentosca.bus.application.service.impl/build.properties
deleted file mode 100644
index 686be4f32..000000000
--- a/org.opentosca.bus.application.service.impl/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
diff --git a/org.opentosca.bus.application.service.impl/pom.xml b/org.opentosca.bus.application.service.impl/pom.xml
deleted file mode 100644
index 298e516be..000000000
--- a/org.opentosca.bus.application.service.impl/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.application.service.impl
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/Activator.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/Activator.java
deleted file mode 100644
index a320650ed..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/Activator.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.opentosca.bus.application.service.impl;
-
-import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
-import org.apache.camel.core.osgi.OsgiServiceRegistry;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.opentosca.bus.application.service.impl.route.GetResultRoute;
-import org.opentosca.bus.application.service.impl.route.InvokeOperationRoute;
-import org.opentosca.bus.application.service.impl.route.IsFinishedRoute;
-import org.opentosca.bus.application.service.impl.route.MainRoute;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Activator of the Application Bus.
- *
- *
- * The activator is needed to add and start the camel routes. The bundleID is used for generating
- * the routing endpoint of the Application Bus.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Activator implements BundleActivator {
-
- final private static Logger LOG = LoggerFactory.getLogger(Activator.class);
-
- private static DefaultCamelContext camelContext;
-
- private static String bundleID;
-
- static String getBundleID() {
- return bundleID;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework. BundleContext)
- */
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
-
- // get bundle name, used as routing endpoint
- bundleID = bundleContext.getBundle().getSymbolicName();
-
- camelContext = new OsgiDefaultCamelContext(bundleContext);
-
- // register routes
- camelContext.addRoutes(new MainRoute());
- camelContext.addRoutes(new InvokeOperationRoute());
- camelContext.addRoutes(new IsFinishedRoute());
- camelContext.addRoutes(new GetResultRoute());
-
- // start camel context
- camelContext.start();
-
- Activator.LOG.info("Application Bus started.");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(final BundleContext bundleContext) throws Exception {
- camelContext = null;
-
- Activator.LOG.info("Application Bus stopped.");
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/ApplicationBusServiceImpl.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/ApplicationBusServiceImpl.java
deleted file mode 100644
index 7e6f9cc7c..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/ApplicationBusServiceImpl.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.opentosca.bus.application.service.impl;
-
-import org.opentosca.bus.application.service.IApplicationBusService;
-
-/**
- * Application Bus implementation.
- *
- *
- * The routing endpoint is defined here. The Application Bus APIs need this endpoint to send
- * requests to the Application Bus. The endpoint is handed over during the bind process in the
- * respective API implementation.
- *
- *
- * @see IApplicationBusService
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- */
-public class ApplicationBusServiceImpl implements IApplicationBusService {
-
- // Routing endpoint of the Application Bus bundle
- public static final String ENDPOINT = "direct-vm:" + Activator.getBundleID();
-
-
- @Override
- public String getRoutingEndpoint() {
- return ENDPOINT;
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/ContainerProxy.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/ContainerProxy.java
deleted file mode 100644
index 3940653ab..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/ContainerProxy.java
+++ /dev/null
@@ -1,619 +0,0 @@
-package org.opentosca.bus.application.service.impl;
-
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.opentosca.bus.application.service.impl.servicehandler.InstanceDataServiceHandler;
-import org.opentosca.bus.application.service.impl.servicehandler.ToscaServiceHandler;
-import org.opentosca.container.core.model.csar.id.CSARID;
-import org.opentosca.container.core.model.instance.NodeInstance;
-import org.opentosca.container.core.model.instance.ServiceInstance;
-import org.opentosca.container.core.tosca.convention.Utils;
-import org.opentosca.container.core.tosca.model.TDeploymentArtifact;
-import org.opentosca.container.core.tosca.model.TEntityTemplate;
-import org.opentosca.container.core.tosca.model.TNodeTemplate;
-import org.opentosca.container.core.tosca.model.TNodeTypeImplementation;
-import org.opentosca.container.core.tosca.model.TServiceTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- *
- * This class is used as a proxy to the ToscaEngineService & InstanceDataService.
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- * @TODO prototype: refactoring needed, integrate new methods into the ToscaEngineService and use
- * them instead of xml parsing here.
- *
- */
-public class ContainerProxy {
-
- static final private String NAMESPACE = "http://www.uni-stuttgart.de/opentosca";
- static final private String INTERFACES_PROPERTIES_NAME = "ApplicationInterfacesProperties";
- static final private String INTERFACE_INFORMATIONS = "ApplicationInterfaceInformations";
- static final private String INTERFACE_INFORMATION = "ApplicationInterfaceInformation";
- static final private String RELATIVE_ENDPOINT = "Endpoint";
- static final private String PORT = "Port";
- static final private String INVOCATION_TYPE = "InvocationType";
-
- static final private String HOSTED_ON_NAMESPACE = "http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes";
- static final private String HOSTED_ON_LOCALPART = "HostedOn";
-
- final private static Logger LOG = LoggerFactory.getLogger(ContainerProxy.class);
-
-
- /**
- * @param serviceInstanceID
- * @param nodeInstanceID
- * @param nodeTemplateID
- * @return NodeInstance with specified ID
- */
- public static NodeInstance getNodeInstance(final Integer serviceInstanceID, final Integer nodeInstanceID,
- final String nodeTemplateID) {
-
- ContainerProxy.LOG.debug("Searching NodeInstance with serviceInstanceID: " + serviceInstanceID
- + " nodeInstanceID: " + nodeInstanceID + " nodeTemplateID: " + nodeTemplateID);
-
- try {
-
- List nodeInstances;
-
- if (nodeInstanceID == null) {
-
- final String namespace = getServiceInstance(serviceInstanceID).getServiceTemplateID().getNamespaceURI();
- final QName nodeTemplateQName = new QName(namespace, nodeTemplateID);
- nodeInstances = InstanceDataServiceHandler.getInstanceDataService()
- .getNodeInstances(null, nodeTemplateQName, null,
- new URI(serviceInstanceID.toString()));
-
- if (nodeInstances.size() > 0) {
- return nodeInstances.get(0);
- }
-
- } else {
-
- nodeInstances =
- InstanceDataServiceHandler.getInstanceDataService()
- .getNodeInstances(new URI(nodeInstanceID.toString()), null, null, null);
-
- for (final NodeInstance nodeInstance : nodeInstances) {
- if (nodeInstance.getId() == nodeInstanceID) {
- return nodeInstance;
- }
- }
- }
-
- }
- catch (final URISyntaxException e) {
- e.printStackTrace();
- }
-
- ContainerProxy.LOG.warn("No matching NodeInstance found.");
- return null;
- }
-
- /**
- * @param id
- * @return ServiceInstance with specified ID
- */
- protected static ServiceInstance getServiceInstance(final Integer id) {
-
- ContainerProxy.LOG.debug("Searching ServiceInstance with ID: {}", id);
-
- try {
- final List instances =
- InstanceDataServiceHandler.getInstanceDataService().getServiceInstances(new URI(id.toString()), null,
- null);
-
- for (final ServiceInstance instance : instances) {
- if (instance.getDBId() == id) {
- ContainerProxy.LOG.debug("ServiceInstance with matching ID found.");
- return instance;
- }
- }
- }
- catch (final URISyntaxException e) {
- e.printStackTrace();
- }
- ContainerProxy.LOG.warn("No ServiceInstance with matching ID found.");
- return null;
- }
-
- /**
- * Searches for NodeTypeImplementations and their DeploymentArtifacts as well as their
- * ArtifactTemplates of the specified NodeType. If the needed properties are found, they are
- * returned.
- *
- *
- * @param csarID
- * @param nodeTypeName
- * @param interfaceName
- * @return specified properties as Node
- */
- public static Node getPropertiesNode(final CSARID csarID, final QName nodeTypeName, final String interfaceName) {
-
- ContainerProxy.LOG.debug("Searching ArtifactTemplate defining needed properties for Interface: " + interfaceName
- + " of NodeType: " + nodeTypeName + "inside of CSAR: " + csarID);
-
- final List nodeTypeImplementationsIDs =
- ToscaServiceHandler.getToscaEngineService().getTypeImplementationsOfType(csarID, nodeTypeName);
-
- ContainerProxy.LOG.debug("The NodeType: " + nodeTypeName + " has " + nodeTypeImplementationsIDs.size()
- + " NodeTypeImplementations.");
-
- for (final QName nodeTypeImplementationID : nodeTypeImplementationsIDs) {
-
- // get the NodeTypeImplementation
- final TNodeTypeImplementation nodeTypeImplementation =
- (TNodeTypeImplementation) ToscaServiceHandler.getToscaEngineService().getToscaReferenceMapper()
- .getJAXBReference(csarID, nodeTypeImplementationID);
-
- // if there are DAs
- if (nodeTypeImplementation.getDeploymentArtifacts() != null) {
-
- ContainerProxy.LOG.debug("The NodeTypeImplementation: " + nodeTypeImplementation.getName() + " has "
- + nodeTypeImplementation.getDeploymentArtifacts().getDeploymentArtifact().size()
- + " DeploymentArtifacts.");
-
- for (final TDeploymentArtifact da : nodeTypeImplementation.getDeploymentArtifacts()
- .getDeploymentArtifact()) {
-
- ContainerProxy.LOG.debug("- {}", da.getName());
- ContainerProxy.LOG.debug("Searching for ArtifactTemplates.");
-
- final QName artifactRef = da.getArtifactRef();
-
- if (artifactRef != null) {
-
- ContainerProxy.LOG.debug("ArtifactTemplate for DA: " + da.getName() + " found: " + artifactRef
- + ". Getting the properties of it.");
-
- final Document properties =
- ToscaServiceHandler.getToscaEngineService().getPropertiesOfAArtifactTemplate(csarID,
- artifactRef);
-
- if (properties != null) {
-
- ContainerProxy.LOG.debug("Properties of ArtifactTemplate: {} found.", artifactRef);
- ContainerProxy.LOG.debug("Getting the {} elements if existing.",
- INTERFACES_PROPERTIES_NAME);
-
- // get ApplicationInterfacesProperties
- final NodeList appPropsList =
- properties.getElementsByTagNameNS(NAMESPACE, INTERFACES_PROPERTIES_NAME);
-
- ContainerProxy.LOG.debug(appPropsList.getLength() + " " + INTERFACES_PROPERTIES_NAME
- + " elements found.");
-
- boolean hostEndpointSpecified = false;
- boolean portSpecified = false;
- boolean invocationTypeSpecified = false;
- boolean interfaceFound = false;
-
- Node propNode = null;
-
- for (int i = 0; i < appPropsList.getLength(); i++) {
-
- hostEndpointSpecified = false;
- portSpecified = false;
- invocationTypeSpecified = false;
- interfaceFound = false;
-
- ContainerProxy.LOG.debug("Check if information are specified for the correct Interface.");
-
- propNode = appPropsList.item(i);
-
- // get properties like endpoint or
- // invocationType
- final NodeList appProps = propNode.getChildNodes();
-
- for (int i2 = 0; i2 < appProps.getLength(); i2++) {
-
- final Node addProp = appProps.item(i2);
-
- if (addProp.getNodeType() == Node.ELEMENT_NODE) {
-
- if (addProp.getLocalName().equals(RELATIVE_ENDPOINT)) {
- ContainerProxy.LOG.debug("Endpoint property found.");
- hostEndpointSpecified = true;
-
- } else if (addProp.getLocalName().equals(PORT)) {
- ContainerProxy.LOG.debug("Port property found.");
- portSpecified = true;
-
- } else if (addProp.getLocalName().equals(INVOCATION_TYPE)) {
- ContainerProxy.LOG.debug("InvocationType property found.");
- invocationTypeSpecified = true;
-
- } else if (addProp.getLocalName().equals(INTERFACE_INFORMATIONS)) {
-
- // check if interface matches
- final NodeList appInvInterfaceInfo =
- ((Element) addProp).getElementsByTagNameNS(NAMESPACE,
- INTERFACE_INFORMATION);
-
- ContainerProxy.LOG.debug(INTERFACE_INFORMATION + " for "
- + +appInvInterfaceInfo.getLength() + " Interfaces found.");
-
- for (int i3 = 0; i3 < appInvInterfaceInfo.getLength(); i3++) {
-
- final String interfName =
- appInvInterfaceInfo.item(i3).getAttributes().getNamedItem("name")
- .getNodeValue();
-
- if (interfName.equals(interfaceName)) {
- interfaceFound = true;
- ContainerProxy.LOG.debug("Properties for interface: {} found.",
- interfaceName);
-
- }
- }
- }
- }
- }
- }
- if (hostEndpointSpecified && portSpecified && invocationTypeSpecified && interfaceFound) {
- ContainerProxy.LOG.debug("Properties with all needed information(Endpoint & InvocationType) for interface: "
- + interfaceName + " of NodeType: " + nodeTypeName + " inside CSAR: " + csarID
- + " found!");
- return propNode;
- }
- } else {
- ContainerProxy.LOG.debug("ArtifactTemplate : {} has no specified properties.", artifactRef);
- }
- } else {
- ContainerProxy.LOG.debug("No ArtifactTemplate for DA: {} found.", da.getName());
- }
- }
- } else {
- ContainerProxy.LOG.debug("The NodeTypeImplementation {} has no DeploymentArtifacts.",
- nodeTypeImplementation.getName());
- }
- }
- ContainerProxy.LOG.debug("No ArtifactTemplate with needed properties for interface: " + interfaceName
- + " of NodeType: " + nodeTypeName + " inside CSAR: " + csarID + " found!");
- return null;
- }
-
- /**
- * @param propNode
- * @return relative endpoint, specified in properties (as Endpoint property).
- */
- public static String getRelativeEndpoint(final Node propNode) {
-
- // get properties like endpoint or
- // invocationType
- final NodeList appProps = propNode.getChildNodes();
-
- for (int i = 0; i < appProps.getLength(); i++) {
-
- final Node addProp = appProps.item(i);
-
- if (addProp.getNodeType() == Node.ELEMENT_NODE) {
-
- if (addProp.getLocalName().equals(RELATIVE_ENDPOINT)) {
-
- final String hostEndpoint = addProp.getTextContent().trim();
- ContainerProxy.LOG.debug("Endpoint property: {}", hostEndpoint);
- return hostEndpoint;
-
- }
- }
- }
- return null;
- }
-
- /**
- * @param propNode
- * @return port, specified in properties (as Port property).
- */
- public static Integer getPort(final Node propNode) {
-
- // get properties like endpoint or
- // invocationType
- final NodeList appProps = propNode.getChildNodes();
-
- for (int i = 0; i < appProps.getLength(); i++) {
-
- final Node addProp = appProps.item(i);
-
- if (addProp.getNodeType() == Node.ELEMENT_NODE) {
-
- if (addProp.getLocalName().equals(PORT)) {
-
- final Integer port = Integer.parseInt(addProp.getTextContent().trim());
- ContainerProxy.LOG.debug("Port property: {}", port);
- return port;
-
- }
- }
- }
- return null;
- }
-
- /**
- * @param propNode
- * @return invocationType, specified in properties (as InvocationType property).
- */
- public static String getInvocationType(final Node propNode) {
-
- // get properties like endpoint or
- // invocationType
- final NodeList appProps = propNode.getChildNodes();
-
- for (int i = 0; i < appProps.getLength(); i++) {
-
- final Node addProp = appProps.item(i);
-
- if (addProp.getNodeType() == Node.ELEMENT_NODE) {
-
- if (addProp.getLocalName().equals(INVOCATION_TYPE)) {
- final String invocationType = addProp.getTextContent().trim();
- ContainerProxy.LOG.debug("InvocationType property: {}", invocationType);
- return invocationType;
-
- }
- }
- }
- return null;
- }
-
- /**
- * @param propNode
- * @param interfaceName
- * @return implementing class specified in the properties of the specified interface
- */
- public static String getClass(final Node propNode, final String interfaceName) {
-
- // get properties like endpoint or
- // invocationType
- final NodeList appProps = propNode.getChildNodes();
-
- for (int i = 0; i < appProps.getLength(); i++) {
-
- final Node addProp = appProps.item(i);
-
- if (addProp.getNodeType() == Node.ELEMENT_NODE) {
-
- if (addProp.getLocalName().equals(INTERFACE_INFORMATIONS)) {
-
- // check if interface matches
- final NodeList appInvInterfaceInfo =
- ((Element) addProp).getElementsByTagNameNS(NAMESPACE, INTERFACE_INFORMATION);
-
- ContainerProxy.LOG.debug(INTERFACE_INFORMATIONS + " for " + +appInvInterfaceInfo.getLength()
- + " Interfaces found.");
-
- for (int i2 = 0; i2 < appInvInterfaceInfo.getLength(); i2++) {
-
- final String interfName =
- appInvInterfaceInfo.item(i2).getAttributes().getNamedItem("name").getNodeValue();
-
- if (interfName.equals(interfaceName)) {
- final String className =
- appInvInterfaceInfo.item(i2).getAttributes().getNamedItem("class").getNodeValue();
- ContainerProxy.LOG.debug("Class property: {}", className);
- return className;
-
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * @param csarID
- * @param serviceTemplateID
- * @param nodeTypeQName
- * @return name of a NodeTemplate of the specified NodeType inside of the specified
- * serviceTemplate & csar
- */
- protected static String getANodeTemplateNameOfNodeType(final CSARID csarID, final QName serviceTemplateID,
- final QName nodeTypeQName) {
-
- ContainerProxy.LOG.debug("Searching NodeTemplate of NodeType: " + nodeTypeQName + " in the ServiceTemplate: "
- + serviceTemplateID + " inside the CSAR: " + csarID);
-
- // get the ServiceTemplate
- final TServiceTemplate serviceTemplate =
- (TServiceTemplate) ToscaServiceHandler.getToscaEngineService().getToscaReferenceMapper()
- .getJAXBReference(csarID, serviceTemplateID);
-
- for (final TEntityTemplate entity : serviceTemplate.getTopologyTemplate()
- .getNodeTemplateOrRelationshipTemplate()) {
-
- TNodeTemplate nodeTemplate = new TNodeTemplate();
-
- // get NodeTemplate
- if (entity instanceof TNodeTemplate) {
-
- nodeTemplate = (TNodeTemplate) entity;
-
- if (nodeTemplate.getType() != null) {
-
- if (nodeTemplate.getType().equals(nodeTypeQName)) {
-
- final String nodeTemplateID = nodeTemplate.getId();
- ContainerProxy.LOG.debug("NodeTemplate of NodeType: " + nodeTypeQName
- + " in the ServiceTemplate: " + serviceTemplateID + " inside the CSAR: " + csarID
- + " found. NodeTemplateID: " + nodeTemplateID);
- return nodeTemplateID;
- }
- }
- }
- }
- ContainerProxy.LOG.debug("No NodeTemplate of NodeType: " + nodeTypeQName + " in the ServiceTemplate: "
- + serviceTemplateID + " inside the CSAR: " + csarID + " found.");
- return null;
- }
-
- /**
- * Returns the first NodeTemplate underneath the defined NodeTemplate containing the IP
- * property.
- *
- * @param csarID
- * @param serviceTemplateID
- * @param nodeTemplateID
- * @return name of the first NodeTemplate underneath the defined NodeTemplate containing the IP
- * property.
- *
- */
- public static String getHostedOnNodeTemplateWithSpecifiedIPProperty(final CSARID csarID,
- final QName serviceTemplateID,
- String nodeTemplateID) {
-
- ContainerProxy.LOG.debug("Searching NodeTemplate with specified IP-Property underneath the NodeTemplate: "
- + nodeTemplateID + " of the ServiceTemplate :" + serviceTemplateID + " inside the CSAR: " + csarID);
-
- Document props = ToscaServiceHandler.getToscaEngineService().getPropertiesOfTemplate(csarID, serviceTemplateID,
- nodeTemplateID);
-
- final QName relationshipType = new QName(HOSTED_ON_NAMESPACE, HOSTED_ON_LOCALPART);
-
- while (nodeTemplateID != null && getIpProperty(props) == null) {
-
- ContainerProxy.LOG.debug("{} isn't the searched NodeTemplate.", nodeTemplateID);
- ContainerProxy.LOG.debug("Getting the underneath Node for checking if it is the searched NodeTemplate.");
-
- nodeTemplateID =
- ToscaServiceHandler.getToscaEngineService().getRelatedNodeTemplateID(csarID, serviceTemplateID,
- nodeTemplateID, relationshipType);
-
- if (nodeTemplateID != null) {
- ContainerProxy.LOG.debug("Checking if the underneath Node: {} is the searched NodeTemplate.",
- nodeTemplateID);
-
- props = ToscaServiceHandler.getToscaEngineService().getPropertiesOfTemplate(csarID, serviceTemplateID,
- nodeTemplateID);
-
- } else {
- ContainerProxy.LOG.debug("No underneath Node found.");
- }
- }
-
- if (nodeTemplateID != null) {
- ContainerProxy.LOG.debug("NodeTemplate with specified IP-Property in the ServiceTemplate: "
- + serviceTemplateID + " inside the CSAR: " + csarID + " found: " + nodeTemplateID);
- } else {
- ContainerProxy.LOG.debug("No NodeTemplate with specified IP-Property in the ServiceTemplate: "
- + serviceTemplateID + " inside the CSAR: " + csarID + " found.");
- }
- return nodeTemplateID;
- }
-
- /**
- *
- * Returns the in the InstanceDataService stored IP property of the specified ServiceInstance &
- * NodeTemplate.
- *
- *
- * @param serviceInstanceID
- * @param nodeTemplateQName
- * @return IP property
- */
- public static URL getIpFromInstanceDataProperties(final URI serviceInstanceID, final QName nodeTemplateQName) {
-
- ContainerProxy.LOG.debug("Getting IP-Property from InstanceDataService of NodeTemplate: " + nodeTemplateQName
- + " of ServiceInstanceID: " + serviceInstanceID + ".");
-
- final List nodeInstances =
- InstanceDataServiceHandler.getInstanceDataService().getNodeInstances(null, nodeTemplateQName, null,
- serviceInstanceID);
-
- for (final NodeInstance nodeInstance : nodeInstances) {
-
- final Document props = nodeInstance.getProperties();
-
- final String ip = getIpProperty(props);
-
- if (ip != null) {
- ContainerProxy.LOG.debug("IP-Property from InstanceDataService of NodeTemplate: " + nodeTemplateQName
- + " ServiceInstanceID: " + serviceInstanceID + " found: " + ip);
- try {
- return new URL(ip);
- }
- catch (final MalformedURLException e) {
- e.printStackTrace();
- }
- }
- }
- ContainerProxy.LOG.debug("No IP-Property from InstanceDataService of NodeTemplate: " + nodeTemplateQName
- + " ServiceInstanceID: " + serviceInstanceID + " found.");
- return null;
- }
-
- /**
- * @param props to check
- * @return IP property, if exist. Otherwise null.
- */
- private static String getIpProperty(final Document props) {
-
- if (props != null) {
-
- ContainerProxy.LOG.debug("Checking if IP-Property is defined in the xml document: " + docToString(props));
-
- final List knownIpProperties = Utils.getSupportedVirtualMachineIPPropertyNames();
-
- for (final String ipProperty : knownIpProperties) {
-
- final NodeList list = props.getElementsByTagName(ipProperty);
-
- if (list.getLength() > 0) {
- final String ip = list.item(0).getTextContent();
- ContainerProxy.LOG.debug("Property: {} is defined: {}", ipProperty, ip);
- return ip;
- }
-
- }
-
- }
- ContainerProxy.LOG.debug("No IP-Property defined.");
- return null;
- }
-
- /**
- * Transforms a document into a String.
- *
- * @param doc
- * @return document content as String.
- */
- private static String docToString(final Document doc) {
- String output = null;
- final TransformerFactory tf = TransformerFactory.newInstance();
- Transformer transformer;
- try {
- transformer = tf.newTransformer();
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- final StringWriter writer = new StringWriter();
- transformer.transform(new DOMSource(doc), new StreamResult(writer));
- output = writer.getBuffer().toString().replaceAll("\n|\r", "");
- }
- catch (final TransformerException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return output;
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/model/QueueMap.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/model/QueueMap.java
deleted file mode 100644
index 29f995dbf..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/model/QueueMap.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.opentosca.bus.application.service.impl.model;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Map that manages the requests. RequestID is used as key of the map. The value
- * of the map indicates if the invocation has finished or not.
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class QueueMap {
-
- final private static Logger LOG = LoggerFactory.getLogger(QueueMap.class);
-
- private static ConcurrentHashMap queue = new ConcurrentHashMap<>();
-
- /**
- * Inserts an entry into the queue (if not already existing) and set it to finished.
- *
- * @param id of the request
- */
- public static void finished(final String id) {
-
- QueueMap.LOG.debug("Request with ID: {} has finished.", id);
-
- queue.put(id, true);
- }
-
- /**
- * Inserts an entry into the queue and set it to notFinished. Only if the id not already exists.
- *
- * @param id of the request
- */
- public static void notFinished(final String id) {
-
- QueueMap.LOG.debug("Request with ID: {} hasn't finished yet.", id);
-
- queue.putIfAbsent(id, false);
- }
-
- /**
- * Inserts an entry into the queue.
- *
- * @param id of the request
- * @param isFinished specifies if the invocation has finished or not
- */
- public static void put(final String id, final Boolean isFinished) {
-
- QueueMap.LOG.debug("RequestID: {}, isFinished: {}", id, isFinished);
-
- queue.put(id, isFinished);
- }
-
- /**
- * @param id of the request
- * @return true if the invocation has finished. Otherwise false
- */
- public static boolean hasFinished(final String id) {
-
- return queue.get(id);
- }
-
- /**
- * @param id of the request
- * @return true if the queue contains the specified requestID. Otherwise false
- */
- public static boolean containsID(final String id) {
- return queue.containsKey(id);
- }
-
- /**
- * Removes the entry with the specified requestID from the queue.
- *
- * @param id of the request
- */
- public static void remove(final String id) {
- queue.remove(id);
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/model/RequestID.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/model/RequestID.java
deleted file mode 100644
index 63bb82df2..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/model/RequestID.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.opentosca.bus.application.service.impl.model;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- *
- * Manages the requestIDs needed to correlate the invocation-requests, the isFinished-requests as
- * well as the getResult-requests.
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class RequestID {
-
- private static AtomicLong incrementer = new AtomicLong(0);
-
- /**
- * @return requestID
- */
- public synchronized static Long getNextID() {
-
- final Long id = incrementer.getAndIncrement();
-
- // For the unlikely case, that MAX_Value is reached, begin with 0
- // again. Assumption: old requests were processed in the mean time.
- if (id == Long.MAX_VALUE) {
- incrementer.set(0);
- }
-
- return id;
- }
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/model/ResultMap.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/model/ResultMap.java
deleted file mode 100644
index d1d684cee..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/model/ResultMap.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.opentosca.bus.application.service.impl.model;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- *
- * Map that manages the invocation results. RequestID is used as key of the map. The
- * value of the map is the result of the invocation. Or null if the invocation
- * failed.
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class ResultMap {
-
- private static ConcurrentHashMap invocations = new ConcurrentHashMap<>();
-
- /**
- * @param id of the request
- * @param obj result of the invocation.
- */
- public static void put(final String id, final Object obj) {
- invocations.put(id, obj);
- }
-
- /**
- * @param id
- * @return result of the invocation. Void if the invoked method was of return type
- * void. null if the invocation failed.
- */
- public static Object get(final String id) {
- return invocations.get(id);
- }
-
- /**
- * @param id of the request
- * @return true if the map contains the specified requestID. Otherwise false
- */
- public static boolean containsID(final String id) {
- return invocations.containsKey(id);
- }
-
- /**
- * Removes the entry with the specified requestID from the map.
- *
- * @param id of the request
- */
- public static void remove(final String id) {
- invocations.remove(id);
- }
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/GetResultProcessor.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/GetResultProcessor.java
deleted file mode 100644
index 449218283..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/GetResultProcessor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.opentosca.bus.application.service.impl.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.opentosca.bus.application.model.exception.ApplicationBusInternalException;
-import org.opentosca.bus.application.service.impl.model.QueueMap;
-import org.opentosca.bus.application.service.impl.model.ResultMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * GetResultProcessor of the Application Bus.
- *
- *
- * This processor handles "getResult" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class GetResultProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(GetResultProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- final String requestID = exchange.getIn().getBody(String.class);
-
- GetResultProcessor.LOG.debug("getResult request received. RequestID: {}", requestID);
-
- if (ResultMap.containsID(requestID)) {
-
- GetResultProcessor.LOG.debug("Getting result.");
-
- final Object result = ResultMap.get(requestID);
-
- // "Garbage collection": Remove polled responses. Maybe
- // client should actively delete it.
- ResultMap.remove(requestID);
- QueueMap.remove(requestID);
-
- exchange.getIn().setBody(result);
-
- } else if (!QueueMap.containsID(requestID)) {
- GetResultProcessor.LOG.warn("Unknown RequestID: {}", requestID);
- exchange.getIn().setBody(new ApplicationBusInternalException("Unknown RequestID: " + requestID));
- } else {
- GetResultProcessor.LOG.warn("Error while invoking specified method.");
- exchange.getIn().setBody(new ApplicationBusInternalException("Error while invoking specified method."));
- }
-
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/InvocationRequestProcessor.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/InvocationRequestProcessor.java
deleted file mode 100644
index 11ab1a645..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/InvocationRequestProcessor.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package org.opentosca.bus.application.service.impl.processor;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-import org.opentosca.bus.application.model.constants.ApplicationBusConstants;
-import org.opentosca.bus.application.model.exception.ApplicationBusInternalException;
-import org.opentosca.bus.application.service.impl.ContainerProxy;
-import org.opentosca.bus.application.service.impl.route.InvokeOperationRoute;
-import org.opentosca.bus.application.service.impl.servicehandler.ApplicationBusPluginServiceHandler;
-import org.opentosca.container.core.model.csar.id.CSARID;
-import org.opentosca.container.core.model.instance.NodeInstance;
-import org.opentosca.container.core.model.instance.ServiceInstance;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Node;
-
-/**
- * InvocationRequestProcessor of the Application Bus.
- *
- *
- * This processor handles "invokeOperation" requests. Needed information are collected in order to
- * determine the endpoint of the NodeTemplate of which the specified method should be invoked. The
- * effective invocation is done by the Application Bus plugins depending on their supporting
- * invocation types.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class InvocationRequestProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(InvocationRequestProcessor.class);
-
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- InvocationRequestProcessor.LOG.info("InvokeOperation request processing started...");
-
- final Message message = exchange.getIn();
-
- final Integer serviceInstanceID =
- message.getHeader(ApplicationBusConstants.SERVICE_INSTANCE_ID_INT.toString(), Integer.class);
- InvocationRequestProcessor.LOG.debug("serviceInstanceID: {}", serviceInstanceID);
-
- String nodeTemplateID = message.getHeader(ApplicationBusConstants.NODE_TEMPLATE_ID.toString(), String.class);
- InvocationRequestProcessor.LOG.debug("nodeTemplateID: {}", nodeTemplateID);
-
- final Integer nodeInstanceID =
- message.getHeader(ApplicationBusConstants.NODE_INSTANCE_ID_INT.toString(), Integer.class);
- InvocationRequestProcessor.LOG.debug("nodeInstanceID: {}", nodeInstanceID);
-
- final String interfaceName = message.getHeader(ApplicationBusConstants.INTERFACE_NAME.toString(), String.class);
- InvocationRequestProcessor.LOG.debug("interfaceName: {}", interfaceName);
-
- final String operationName = message.getHeader(ApplicationBusConstants.OPERATION_NAME.toString(), String.class);
- InvocationRequestProcessor.LOG.debug("operationName: {}", operationName);
-
- String invocationType = null;
- String className = null;
- URL endpoint = null;
-
- final NodeInstance nodeInstance =
- ContainerProxy.getNodeInstance(serviceInstanceID, nodeInstanceID, nodeTemplateID);
-
- if (nodeInstance != null) {
-
- final QName nodeType = nodeInstance.getNodeType();
- final ServiceInstance serviceInstance = nodeInstance.getServiceInstance();
- final CSARID csarID = serviceInstance.getCSAR_ID();
- final QName serviceTemplateID = serviceInstance.getServiceTemplateID();
-
- if (nodeTemplateID == null) {
- nodeTemplateID = nodeInstance.getNodeTemplateID().getLocalPart();
- }
-
- InvocationRequestProcessor.LOG.debug("Matching NodeInstance found: ID: " + nodeInstance.getNodeInstanceID()
- + " CSAR-ID: " + csarID + " ServiceTemplateID: " + serviceTemplateID + " NodeTemplateID: "
- + nodeTemplateID + " of type: " + nodeType);
-
- final Node properties = ContainerProxy.getPropertiesNode(csarID, nodeType, interfaceName);
-
- if (properties != null) {
-
- final String relativeHostEndpoint = ContainerProxy.getRelativeEndpoint(properties);
- final Integer port = ContainerProxy.getPort(properties);
- invocationType = ContainerProxy.getInvocationType(properties);
- className = ContainerProxy.getClass(properties, interfaceName);
-
- if (relativeHostEndpoint != null && port != null && invocationType != null && className != null) {
-
- final String hostedOnNodeTemplateID =
- ContainerProxy.getHostedOnNodeTemplateWithSpecifiedIPProperty(csarID, serviceTemplateID,
- nodeTemplateID);
-
- if (hostedOnNodeTemplateID != null) {
-
- // get the Namespace from the
- // serviceTemplate
- final QName hostedOnNodeTemplateQName =
- new QName(serviceTemplateID.getNamespaceURI(), hostedOnNodeTemplateID);
-
- final URL hostedOnNodeURL =
- ContainerProxy.getIpFromInstanceDataProperties(serviceInstance.getServiceInstanceID(),
- hostedOnNodeTemplateQName);
-
- if (hostedOnNodeURL != null) {
-
- InvocationRequestProcessor.LOG.debug("Generating endpoint for Node: {}", nodeTemplateID);
-
- try {
- endpoint = new URL(hostedOnNodeURL.getProtocol(), hostedOnNodeURL.getAuthority(), port,
- relativeHostEndpoint);
- InvocationRequestProcessor.LOG.debug("Generated endpoint: " + endpoint);
-
- }
- catch (final MalformedURLException e) {
- InvocationRequestProcessor.LOG.error("Generating endpoint for Node: {} failed!",
- nodeTemplateID);
- e.printStackTrace();
- }
- }
- }
- }
- }
- }
-
- if (endpoint != null) {
-
- message.setHeader(ApplicationBusConstants.CLASS_NAME.toString(), className);
-
- message.setHeader(ApplicationBusConstants.INVOCATION_ENDPOINT_URL.toString(), endpoint.toString());
-
- InvocationRequestProcessor.LOG.debug("Searching an Application Bus Plugin for InvocationType: {}",
- invocationType);
- // set ID of the matching Application Bus Plugin bundle. Needed for
- // routing.
- final String appBusPluginEndpoint =
- ApplicationBusPluginServiceHandler.getApplicationBusPluginBundleID(invocationType);
-
- if (appBusPluginEndpoint != null) {
-
- InvocationRequestProcessor.LOG.debug("Application Bus Plugin with matching InvocationType: {} found. Endpoint: {}",
- invocationType, appBusPluginEndpoint);
- exchange.getIn().setHeader(InvokeOperationRoute.APPLICATION_BUS_PLUGIN_ENDPOINT_HEADER,
- appBusPluginEndpoint);
-
- }
-
- } else {
-
- throw new ApplicationBusInternalException("Couldn't gather all needed information.");
- }
-
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/IsFinishedProcessor.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/IsFinishedProcessor.java
deleted file mode 100644
index 155fe2fb0..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/IsFinishedProcessor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.opentosca.bus.application.service.impl.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.opentosca.bus.application.model.exception.ApplicationBusInternalException;
-import org.opentosca.bus.application.service.impl.model.QueueMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * IsFinishedProcessor of the Application Bus.
- *
- *
- * This processor handles "isFinished" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class IsFinishedProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(IsFinishedProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- final String requestID = exchange.getIn().getBody(String.class);
-
- IsFinishedProcessor.LOG.debug("Queue polling for RequestID: {}", requestID);
-
- if (QueueMap.containsID(requestID)) {
- IsFinishedProcessor.LOG.debug("RequestID is known.");
-
- if (QueueMap.hasFinished(requestID)) {
- IsFinishedProcessor.LOG.debug("Invocation has finished.");
- exchange.getIn().setBody(true);
-
- } else {
- IsFinishedProcessor.LOG.debug("Invocation has not finished yet.");
- exchange.getIn().setBody(false);
- }
- } else {
- IsFinishedProcessor.LOG.warn("Unknown RequestID: {}", requestID);
- exchange.getIn().setBody(new ApplicationBusInternalException("Unknown RequestID: " + requestID));
- }
-
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/ParameterCheckProcessor.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/ParameterCheckProcessor.java
deleted file mode 100644
index e83f8e58d..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/processor/ParameterCheckProcessor.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.opentosca.bus.application.service.impl.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-import org.opentosca.bus.application.model.constants.ApplicationBusConstants;
-import org.opentosca.bus.application.model.exception.ApplicationBusExternalException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * ParameterCheckProcessor of the Application Bus.
- *
- *
- * This processor checks if all needed parameters are specified..
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class ParameterCheckProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(ParameterCheckProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws ApplicationBusExternalException {
-
- ParameterCheckProcessor.LOG.info("Checking if all needed parameters are specified...");
-
- final Message message = exchange.getIn();
-
- final Integer serviceInstanceID =
- message.getHeader(ApplicationBusConstants.SERVICE_INSTANCE_ID_INT.toString(), Integer.class);
- ParameterCheckProcessor.LOG.debug("serviceInstanceID: {}", serviceInstanceID);
-
- final String nodeTemplateID =
- message.getHeader(ApplicationBusConstants.NODE_TEMPLATE_ID.toString(), String.class);
- ParameterCheckProcessor.LOG.debug("nodeTemplateID: {}", nodeTemplateID);
-
- final Integer nodeInstanceID =
- message.getHeader(ApplicationBusConstants.NODE_INSTANCE_ID_INT.toString(), Integer.class);
- ParameterCheckProcessor.LOG.debug("nodeInstanceID: {}", nodeInstanceID);
-
- final String interfaceName = message.getHeader(ApplicationBusConstants.INTERFACE_NAME.toString(), String.class);
- ParameterCheckProcessor.LOG.debug("interfaceName: {}", interfaceName);
-
- final String operationName = message.getHeader(ApplicationBusConstants.OPERATION_NAME.toString(), String.class);
- ParameterCheckProcessor.LOG.debug("operationName: {}", operationName);
-
- if (serviceInstanceID != null || nodeInstanceID != null) {
-
- final StringBuilder error = new StringBuilder();
-
- if (interfaceName == null) {
- error.append(" >>Interface<<");
- }
-
- if (operationName == null) {
- error.append(" >>Operation<<");
- }
-
- if (serviceInstanceID != null) {
-
- if (nodeTemplateID == null) {
- error.append(" >>NodeTemplateID<<");
- }
-
- }
-
- if (!error.toString().isEmpty()) {
- ParameterCheckProcessor.LOG.warn("Can't process request: " + error.toString() + " is missing.");
- throw new ApplicationBusExternalException(
- "Can't process request: " + error.toString() + " is missing.");
- }
-
- } else {
- ParameterCheckProcessor.LOG.warn("Can't process request: neither >>ServiceInstanceID<< nor >>NodeInstanceID<< is specified!");
- throw new ApplicationBusExternalException(
- "Can't process request: neither >>ServiceInstanceID<< nor >>NodeInstanceID<< is specified!");
- }
-
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/route/GetResultRoute.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/route/GetResultRoute.java
deleted file mode 100644
index e0ec560d2..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/route/GetResultRoute.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.opentosca.bus.application.service.impl.route;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.opentosca.bus.application.service.impl.processor.GetResultProcessor;
-
-/**
- * GetResultRoute of the Application Bus.
- *
- *
- * "getResult" requests are handed over to the GetResultProcessor.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class GetResultRoute extends RouteBuilder {
-
- @Override
- public void configure() throws Exception {
-
- final Processor getResultProcessor = new GetResultProcessor();
-
- // handle exceptions
- onException(Exception.class).setBody(property(Exchange.EXCEPTION_CAUGHT));
-
- from(MainRoute.GET_RESULT_ENDPOINT).process(getResultProcessor);
-
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/route/InvokeOperationRoute.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/route/InvokeOperationRoute.java
deleted file mode 100644
index 4ee690249..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/route/InvokeOperationRoute.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.opentosca.bus.application.service.impl.route;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.builder.RouteBuilder;
-import org.opentosca.bus.application.model.exception.ApplicationBusExternalException;
-import org.opentosca.bus.application.model.exception.ApplicationBusInternalException;
-import org.opentosca.bus.application.service.impl.model.QueueMap;
-import org.opentosca.bus.application.service.impl.model.RequestID;
-import org.opentosca.bus.application.service.impl.model.ResultMap;
-import org.opentosca.bus.application.service.impl.processor.InvocationRequestProcessor;
-import org.opentosca.bus.application.service.impl.processor.ParameterCheckProcessor;
-
-/**
- * InvokeOperationRoute of the Application Bus.
- *
- *
- * "invokeOperation" requests are handled here.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class InvokeOperationRoute extends RouteBuilder {
-
- public final static String APPLICATION_BUS_PLUGIN_ENDPOINT_HEADER = "ApplicationBusPluginEndpoint";
- private final static String APPLICATION_BUS_REQUEST_ID_HEADER = "ApplicationBusRequestID";
-
- @Override
- public void configure() throws Exception {
-
- final ParameterCheckProcessor checkProcessor = new ParameterCheckProcessor();
- final InvocationRequestProcessor requestProcessor = new InvocationRequestProcessor();
-
- // handle exceptions
- onException(Exception.class).setBody(property(Exchange.EXCEPTION_CAUGHT)).to("direct:handleResponse");
-
- // check if all needed parameters are specified. If this is the case set
- // requestID (for the response) and send request to further processing.
- from(MainRoute.INVOKE_ENDPOINT).doTry().process(checkProcessor).doCatch(ApplicationBusExternalException.class)
- .end().choice().when(property(Exchange.EXCEPTION_CAUGHT).isNull())
- .setHeader(APPLICATION_BUS_REQUEST_ID_HEADER,
- method(RequestID.class, "getNextID"))
- .wireTap("direct:invokeProcess").end().to("direct:init").otherwise()
- .setBody(property(Exchange.EXCEPTION_CAUGHT));
-
- // set "isFinsihed"-flag to false for this request
- from("direct:init").bean(QueueMap.class, "notFinished(${header." + APPLICATION_BUS_REQUEST_ID_HEADER + "})")
- .setBody(simple("${header." + APPLICATION_BUS_REQUEST_ID_HEADER + "}"));
-
- // check if matching plugin is available and send request to it.
- // Otherwise throw exception.
- from("direct:invokeProcess").setExchangePattern(ExchangePattern.InOut).process(requestProcessor).choice()
- .when(header(APPLICATION_BUS_PLUGIN_ENDPOINT_HEADER).isNotNull())
- .to("direct:toPlugin").endChoice().otherwise()
- .throwException(new ApplicationBusInternalException(
- "No matching Application Bus Plugin found."));
-
- // send to plugin
- from("direct:toPlugin").doTry().recipientList(header(APPLICATION_BUS_PLUGIN_ENDPOINT_HEADER)).end()
- .doCatch(Exception.class).setBody(property(Exchange.EXCEPTION_CAUGHT)).doFinally()
- .to("direct:handleResponse").end();
-
- // handle response: set "isFinsihed"-flag to true and store result in
- // ResultMap
- from("direct:handleResponse").bean(QueueMap.class,
- "finished(${header." + APPLICATION_BUS_REQUEST_ID_HEADER + "})")
- .bean(ResultMap.class,
- "put(${header." + APPLICATION_BUS_REQUEST_ID_HEADER + "}, ${body})")
- .stop();
-
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/route/IsFinishedRoute.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/route/IsFinishedRoute.java
deleted file mode 100644
index 61d14e1bf..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/route/IsFinishedRoute.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.opentosca.bus.application.service.impl.route;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.opentosca.bus.application.service.impl.processor.IsFinishedProcessor;
-
-
-/**
- * IsFinishedRoute of the Application Bus.
- *
- *
- * "isFinished" requests are handed over to the IsFinishedProcessor.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class IsFinishedRoute extends RouteBuilder {
-
- @Override
- public void configure() throws Exception {
-
- final Processor isFinishedProcessor = new IsFinishedProcessor();
-
- // handle exceptions
- onException(Exception.class).setBody(property(Exchange.EXCEPTION_CAUGHT));
-
- from(MainRoute.IS_FINISHED_ENDPOINT).process(isFinishedProcessor);
-
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/servicehandler/ApplicationBusPluginServiceHandler.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/servicehandler/ApplicationBusPluginServiceHandler.java
deleted file mode 100644
index 3823ba1f4..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/servicehandler/ApplicationBusPluginServiceHandler.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.opentosca.bus.application.service.impl.servicehandler;
-
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.opentosca.bus.application.plugin.service.IApplicationBusPluginService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Class to bind interface {@link IApplicationBusPluginService}.
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class ApplicationBusPluginServiceHandler {
-
- // HashMap that stores available plug-ins. The supported InvocationType is
- // used as key and the corresponding routing endpoint as value.
- private static ConcurrentHashMap pluginServices = new ConcurrentHashMap<>();
-
- final private static Logger LOG = LoggerFactory.getLogger(ApplicationBusPluginServiceHandler.class);
-
-
- /**
- * @param invocationType
- * @return BundleID of the matching ApplicationBusPlugin
- */
- public static String getApplicationBusPluginBundleID(final String invocationType) {
-
- return pluginServices.get(invocationType);
- }
-
- /**
- * Bind IApplicationBusPluginService and store InvocationType & BundleID in local HashMap.
- *
- * @param plugin - A AppInvokerPluginService to register.
- */
- public void bindPluginService(final IApplicationBusPluginService plugin) {
-
- final List types = plugin.getSupportedInvocationTypes();
-
- for (final String type : types) {
- pluginServices.put(type, plugin.getRoutingEndpoint());
- ApplicationBusPluginServiceHandler.LOG.debug("Bound IApplicationBusPluginService: {} for Type: {}",
- plugin.toString(), type);
- }
-
- }
-
- /**
- * Unbind IApplicationBusPluginService.
- *
- * @param plugin - A IApplicationBusPluginService to unregister.
- */
- public void unbindPluginService(final IApplicationBusPluginService plugin) {
-
- final List types = plugin.getSupportedInvocationTypes();
-
- for (final String type : types) {
- final Object deletedObject = pluginServices.remove(type);
- if (deletedObject != null) {
- ApplicationBusPluginServiceHandler.LOG.debug("Unbound IApplicationBusPluginService: {} for Type: {}",
- plugin.toString(), type);
- } else {
- ApplicationBusPluginServiceHandler.LOG.debug("IApplicationBusPluginService {} could not be unbound, because it is not bound!",
- plugin.toString());
- }
- }
- }
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/servicehandler/InstanceDataServiceHandler.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/servicehandler/InstanceDataServiceHandler.java
deleted file mode 100644
index 54d27f5bf..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/servicehandler/InstanceDataServiceHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.opentosca.bus.application.service.impl.servicehandler;
-
-import org.opentosca.container.core.service.IInstanceDataService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Class to bind interface {@link IInstanceDataService}.
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class InstanceDataServiceHandler {
-
- final private static Logger LOG = LoggerFactory.getLogger(InstanceDataServiceHandler.class);
-
- private static IInstanceDataService instanceDataService;
-
-
- public static IInstanceDataService getInstanceDataService() {
- return InstanceDataServiceHandler.instanceDataService;
- }
-
- /**
- * Bind IInstanceDataService.
- *
- * @param instanceDataService - A IInstanceDataService to register.
- */
- public void bindInstanceDataService(final IInstanceDataService instanceDataService) {
- InstanceDataServiceHandler.LOG.debug("App-Invoker: Bind IInstanceDataService");
- InstanceDataServiceHandler.instanceDataService = instanceDataService;
- }
-
- /**
- * Unbind IInstanceDataService.
- *
- * @param instanceDataService - A IInstanceDataService to unregister.
- */
- public void unbindInstanceDataService(final IInstanceDataService instanceDataService) {
- InstanceDataServiceHandler.LOG.debug("App-Invoker: Unbind IInstanceDataService");
- InstanceDataServiceHandler.instanceDataService = null;
- }
-
-}
diff --git a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/servicehandler/ToscaServiceHandler.java b/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/servicehandler/ToscaServiceHandler.java
deleted file mode 100644
index 40093d084..000000000
--- a/org.opentosca.bus.application.service.impl/src/org/opentosca/bus/application/service/impl/servicehandler/ToscaServiceHandler.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.opentosca.bus.application.service.impl.servicehandler;
-
-import org.opentosca.container.core.engine.IToscaEngineService;
-import org.opentosca.container.core.engine.xml.IXMLSerializer;
-import org.opentosca.container.core.engine.xml.IXMLSerializerService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Class to bind interface {@link IXMLSerializerService} & {@link IXMLSerializerService}.
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class ToscaServiceHandler {
-
- final private static Logger LOG = LoggerFactory.getLogger(ToscaServiceHandler.class);
-
- private static IXMLSerializerService xmlSerializerService;
- private static IToscaEngineService toscaEngineService;
-
-
- /**
- * @return IXMLSerializer
- */
- public static IXMLSerializer getIXMLSerializer() {
- return ToscaServiceHandler.xmlSerializerService.getXmlSerializer();
- }
-
- /**
- * Bind IXMLSerializerService.
- *
- * @param xmlSerializerService - A IXMLSerializerService to register.
- */
- public void bindIXMLSerializerService(final IXMLSerializerService xmlSerializerService) {
- ToscaServiceHandler.LOG.debug("App-Invoker: Bind IXMLSerializerService");
- ToscaServiceHandler.xmlSerializerService = xmlSerializerService;
- }
-
- /**
- * Unbind IXMLSerializerService.
- *
- * @param xmlSerializerService - A IXMLSerializerService to unregister.
- */
- public void unbindIXMLSerializerService(final IXMLSerializerService xmlSerializerService) {
- ToscaServiceHandler.LOG.debug("App-Invoker: Unbind IXMLSerializerService");
- ToscaServiceHandler.xmlSerializerService = null;
- }
-
- /**
- * @return IToscaEngineService
- */
- public static IToscaEngineService getToscaEngineService() {
- return ToscaServiceHandler.toscaEngineService;
- }
-
- /**
- * Bind IToscaEngineService.
- *
- * @param toscaEngineService - A IToscaEngineService to register.
- */
- public void bindToscaEngineService(final IToscaEngineService toscaEngineService) {
- ToscaServiceHandler.LOG.debug("App-Invoker: Bind IToscaEngineService");
- ToscaServiceHandler.toscaEngineService = toscaEngineService;
- }
-
- /**
- * Unbind IToscaEngineService.
- *
- * @param toscaEngineService - A IToscaEngineService to unregister.
- */
- public void unbindToscaEngineService(final IToscaEngineService toscaEngineService) {
- ToscaServiceHandler.LOG.debug("App-Invoker: Unbind IToscaEngineService");
- ToscaServiceHandler.toscaEngineService = null;
- }
-}
diff --git a/org.opentosca.bus.application.service/META-INF/MANIFEST.MF b/org.opentosca.bus.application.service/META-INF/MANIFEST.MF
deleted file mode 100644
index 01463cf17..000000000
--- a/org.opentosca.bus.application.service/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Interface of the Application Bus Service
-Bundle-SymbolicName: org.opentosca.bus.application.service
-Bundle-Version: 2.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.opentosca.bus.application.service
diff --git a/org.opentosca.bus.application.service/build.properties b/org.opentosca.bus.application.service/build.properties
deleted file mode 100644
index a12d47e56..000000000
--- a/org.opentosca.bus.application.service/build.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .
diff --git a/org.opentosca.bus.application.service/pom.xml b/org.opentosca.bus.application.service/pom.xml
deleted file mode 100644
index 520015e87..000000000
--- a/org.opentosca.bus.application.service/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.application.service
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.api.osgievent/META-INF/MANIFEST.MF b/org.opentosca.bus.management.api.osgievent/META-INF/MANIFEST.MF
deleted file mode 100644
index d7c2b2816..000000000
--- a/org.opentosca.bus.management.api.osgievent/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,31 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.opentosca.bus.management.api.osgievent
-Bundle-SymbolicName: org.opentosca.bus.management.api.osgievent
-Bundle-Version: 2.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Service-Component: OSGI-INF/MBEventHandler - component.xml
-Import-Package: org.apache.camel;version="2.10.4",
- org.apache.camel.builder;version="2.10.4",
- org.apache.camel.component.dataset;version="2.10.4",
- org.apache.camel.core.osgi;version="2.10.4",
- org.apache.camel.impl;version="2.10.4",
- org.apache.camel.model;version="2.10.4",
- org.apache.camel.spi;version="2.10.4",
- org.glassfish.jersey.uri;version="2.22.2",
- org.opentosca.container.core.tosca.convention,
- org.opentosca.container.engine.plan.plugin,
- org.opentosca.container.engine.plan.plugin.bpel,
- org.opentosca.planbuilder.export,
- org.opentosca.planbuilder.importer,
- org.opentosca.planbuilder.model.plan,
- org.opentosca.planbuilder.model.plan.bpel,
- org.opentosca.planbuilder.model.tosca,
- org.osgi.framework;version="1.6.0",
- org.osgi.service.component;version="1.1.0",
- org.osgi.service.event;version="1.3.0",
- org.slf4j;version="1.7.5"
-Bundle-Activator: org.opentosca.bus.management.api.osgievent.Activator
-Require-Bundle: org.opentosca.container.core;bundle-version="1.0.0",
- org.opentosca.bus.management;bundle-version="1.0.0"
-Bundle-ActivationPolicy: lazy
diff --git a/org.opentosca.bus.management.api.osgievent/OSGI-INF/MBEventHandler - component.xml b/org.opentosca.bus.management.api.osgievent/OSGI-INF/MBEventHandler - component.xml
deleted file mode 100644
index 159fcb745..000000000
--- a/org.opentosca.bus.management.api.osgievent/OSGI-INF/MBEventHandler - component.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
- org_opentosca_plans/requests
- org_opentosca_situationadaptation/requests
-
-
diff --git a/org.opentosca.bus.management.api.osgievent/build.properties b/org.opentosca.bus.management.api.osgievent/build.properties
deleted file mode 100644
index 686be4f32..000000000
--- a/org.opentosca.bus.management.api.osgievent/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
diff --git a/org.opentosca.bus.management.api.osgievent/pom.xml b/org.opentosca.bus.management.api.osgievent/pom.xml
deleted file mode 100644
index 9d4428281..000000000
--- a/org.opentosca.bus.management.api.osgievent/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.management.api.osgievent
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/Activator.java b/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/Activator.java
deleted file mode 100644
index f521a24d7..000000000
--- a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/Activator.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.opentosca.bus.management.api.osgievent;
-
-import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
-import org.apache.camel.core.osgi.OsgiServiceRegistry;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.opentosca.bus.management.api.osgievent.route.Route;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Activator of the OSGiEvent-Management Bus-API.
- *
- *
- * Copyright 2013 IAAS University of Stuttgart
- *
- *
- * The activator is needed to add and start the camel routes.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Activator implements BundleActivator {
-
- static DefaultCamelContext camelContext;
- static BundleContext ctx;
-
- public static String apiID;
-
- final private static Logger LOG = LoggerFactory.getLogger(Activator.class);
-
-
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
-
- Activator.apiID = bundleContext.getBundle().getSymbolicName();
-
- Activator.ctx = bundleContext;
- Activator.camelContext = new OsgiDefaultCamelContext(bundleContext);
- Activator.camelContext.addRoutes(new Route());
- Activator.camelContext.start();
- Activator.LOG.info("Management Bus-OSGI-Event API started!");
-
- }
-
- @Override
- public void stop(final BundleContext arg0) throws Exception {
- Activator.camelContext = null;
- Activator.LOG.info("Management Bus-OSGI-Event API stopped!");
-
- }
-}
diff --git a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/MBEventHandler.java b/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/MBEventHandler.java
deleted file mode 100644
index cabd389e0..000000000
--- a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/MBEventHandler.java
+++ /dev/null
@@ -1,693 +0,0 @@
-package org.opentosca.bus.management.api.osgievent;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URLEncoder;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-
-import org.apache.camel.ConsumerTemplate;
-import org.apache.camel.Exchange;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.impl.DefaultExchange;
-import org.glassfish.jersey.uri.UriComponent;
-import org.opentosca.bus.management.header.MBHeader;
-import org.opentosca.container.core.common.Settings;
-import org.opentosca.container.core.common.SystemException;
-import org.opentosca.container.core.model.csar.id.CSARID;
-import org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint;
-import org.opentosca.container.core.next.model.NodeTemplateInstance;
-import org.opentosca.container.core.next.model.NodeTemplateInstanceState;
-import org.opentosca.container.core.next.model.PlanInstanceInput;
-import org.opentosca.container.core.next.model.PlanType;
-import org.opentosca.container.core.next.model.RelationshipTemplateInstance;
-import org.opentosca.container.core.next.model.RelationshipTemplateInstanceState;
-import org.opentosca.container.core.next.model.ServiceTemplateInstance;
-import org.opentosca.container.core.next.repository.SituationRepository;
-import org.opentosca.container.core.service.ICoreEndpointService;
-import org.opentosca.container.core.tosca.convention.Types;
-import org.opentosca.container.engine.plan.plugin.IPlanEnginePlanRefPluginService;
-import org.opentosca.container.engine.plan.plugin.bpel.BpelPlanEnginePlugin;
-import org.opentosca.planbuilder.export.Exporter;
-import org.opentosca.planbuilder.importer.Importer;
-import org.opentosca.planbuilder.model.plan.bpel.BPELPlan;
-import org.opentosca.planbuilder.model.tosca.AbstractNodeTemplate;
-import org.opentosca.planbuilder.model.tosca.AbstractPolicy;
-import org.opentosca.planbuilder.model.tosca.AbstractRelationshipTemplate;
-import org.opentosca.planbuilder.model.tosca.AbstractTopologyTemplate;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-import org.osgi.service.event.EventHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * EventHandler of the Management Bus-OSGi-Event-API.
- *
- *
- * Copyright 2013 IAAS University of Stuttgart
- *
- *
- * Handles the events (receive and sent) of the Management Bus-OSGi-Event-API.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- * @author Benjamin Weder - st100495@stud.uni-stuttgart.de
- * @author Kálmán Képes - kepes@iaas.uni-stuttgart.de
- */
-public class MBEventHandler implements EventHandler {
-
- private static final String BPMNNS = "http://www.omg.org/spec/BPMN/20100524/MODEL";
- private static final String BPELNS = "http://docs.oasis-open.org/wsbpel/2.0/process/executable";
-
- private static Logger LOG = LoggerFactory.getLogger(MBEventHandler.class);
-
- private final ExecutorService executor = Executors.newFixedThreadPool(5);
-
- private EventAdmin eventAdmin;
-
- private ConsumerTemplate invokePlan(final String operationName, final String messageID, final boolean async,
- final Long serviceInstanceID, final QName serviceTemplateID,
- final Object message, final CSARID csarID, final QName planID,
- final String planLanguage) {
- MBEventHandler.LOG.debug("Plan invocation is asynchronous: {}", async);
-
- // create the headers for the Exchange which is send to the Management Bus
- final Map headers = new HashMap<>();
- headers.put(MBHeader.CSARID.toString(), csarID);
- headers.put(MBHeader.PLANID_QNAME.toString(), planID);
- headers.put(MBHeader.OPERATIONNAME_STRING.toString(), operationName);
- headers.put(MBHeader.PLANCORRELATIONID_STRING.toString(), messageID);
- headers.put(MBHeader.SERVICETEMPLATEID_QNAME.toString(), serviceTemplateID);
- headers.put("OPERATION", OsgiEventOperations.INVOKE_PLAN.getHeaderValue());
- headers.put("PlanLanguage", planLanguage);
-
-
- if (message instanceof HashMap) {
- MBEventHandler.LOG.debug("Invocation body is of type HashMap.");
-
- URI serviceInstanceURI;
- try {
- serviceInstanceURI = new URI(serviceInstanceID.toString());
- headers.put(MBHeader.SERVICEINSTANCEID_URI.toString(), serviceInstanceURI);
- }
- catch (final URISyntaxException e) {
- MBEventHandler.LOG.warn("Could not generate service instance URL: {}", e.getMessage(), e);
- }
- } else {
- MBEventHandler.LOG.warn("Invocation body is of type: {}", message.getClass());
- }
-
- // templates to communicate with the Management Bus
- final ProducerTemplate template = Activator.camelContext.createProducerTemplate();
- final ConsumerTemplate consumer = Activator.camelContext.createConsumerTemplate();
-
- MBEventHandler.LOG.debug("Correlation id: {}", messageID);
- MBEventHandler.LOG.debug("Sending message {}", message);
-
- // forward request to the Management Bus
- final Exchange requestExchange = new DefaultExchange(Activator.camelContext);
- requestExchange.getIn().setBody(message);
- requestExchange.getIn().setHeaders(headers);
- template.asyncSend("direct:invoke", requestExchange);
- return consumer;
- }
-
- @Override
- public void handleEvent(final Event event) {
-
- // Handle plan invoke requests
- if ("org_opentosca_plans/requests".equals(event.getTopic())) {
- MBEventHandler.LOG.debug("Process event of topic \"org_opentosca_plans/requests\".");
-
- final CSARID csarID = (CSARID) event.getProperty("CSARID");
- final QName planID = (QName) event.getProperty("PLANID");
- final String planLanguage = (String) event.getProperty("PLANLANGUAGE");
-
- if (planLanguage.startsWith(BPMNNS) || planLanguage.startsWith(BPELNS)) {
- MBEventHandler.LOG.debug("Plan invocation with plan language: {}", planLanguage);
-
- final String operationName = (String) event.getProperty("OPERATIONNAME");
- final String messageID = (String) event.getProperty("MESSAGEID");
- final boolean async = (boolean) event.getProperty("ASYNC");
-
- // Optional parameter if message is of type HashMap. Not needed for Document.
- final Long serviceInstanceID = (Long) event.getProperty("SERVICEINSTANCEID");
- final QName serviceTemplateID = (QName) event.getProperty("SERVICETEMPLATEID");
- // Should be of type Document or HashMap. Maybe better handle them
- // with different topics.
- // final Object message = event.getProperty("BODY");
- Map inputParameter = (Map) event.getProperty("INPUTS");
-
- if (inputParameter == null) {
- inputParameter = new HashMap<>();
- }
-
- final Map message =
- createRequestBody(csarID, serviceTemplateID, serviceInstanceID, inputParameter, messageID);
-
- final ConsumerTemplate consumer = invokePlan(operationName, messageID, async, serviceInstanceID,
- serviceTemplateID, message, csarID, planID, planLanguage);
-
- // Threaded reception of response
- this.executor.submit(() -> {
-
- Object response = null;
-
- try {
- consumer.start();
- final Exchange exchange = consumer.receive("direct:response" + messageID);
- response = exchange.getIn().getBody();
- consumer.stop();
- }
- catch (final Exception e) {
- MBEventHandler.LOG.error("Error occured: {}", e.getMessage(), e);
- return;
- }
-
- MBEventHandler.LOG.debug("Received response for request with id {}.", messageID);
-
- final Map responseMap = new HashMap<>();
- responseMap.put("RESPONSE", response);
- responseMap.put("MESSAGEID", messageID);
- responseMap.put("PLANLANGUAGE", planLanguage);
- final Event responseEvent = new Event("org_opentosca_plans/responses", responseMap);
-
- MBEventHandler.LOG.debug("Posting response as OSGi event.");
- this.eventAdmin.postEvent(responseEvent);
- });
-
- } else {
- MBEventHandler.LOG.warn("Unsupported plan language: {}", planLanguage);
- }
- }
-
- // Handle IA invoke requests
- if ("org_opentosca_ia/requests".equals(event.getTopic())) {
- MBEventHandler.LOG.debug("Process event of topic \"org_opentosca_ia/requests\".");
-
- // TODO when needed.
- // Adapt 'MBEventHandler - component.xml' to receive messages from this topic too...
-
- }
-
- if ("org_opentosca_situationadaptation/requests".equals(event.getTopic())) {
- MBEventHandler.LOG.debug("Received SituationAware Adapatioan Event");
- final ServiceTemplateInstance instance = (ServiceTemplateInstance) event.getProperty("SERVICEINSTANCE");
-
- final Map> nodeIds2situationIds =
- (Map>) event.getProperty("NODE2SITUATIONS");
-
- final Importer importer = new Importer();
- final Exporter exporter = new Exporter();
-
- final AbstractTopologyTemplate topology =
- importer.getMainDefinitions(instance.getCsarId()).getServiceTemplates().get(0).getTopologyTemplate();
-
- final ServiceTemplateInstanceConfiguration currentConfig =
- getCurrentServiceTemplateInstanceConfiguration(topology, instance);
- final ServiceTemplateInstanceConfiguration targetConfig =
- getValidServiceTemplateInstanceConfiguration(topology, nodeIds2situationIds);
-
-
-
- final Collection currentConfigNodeIds =
- currentConfig.nodeTemplates.stream().map(x -> x.getId()).collect(Collectors.toList());
- final Collection currentConfigRelationIds =
- currentConfig.relationshipTemplates.stream().map(x -> x.getId()).collect(Collectors.toList());
-
- final Collection targetConfigNodeIds =
- targetConfig.nodeTemplates.stream().map(x -> x.getId()).collect(Collectors.toList());
- final Collection targetConfigRelationIds =
- targetConfig.relationshipTemplates.stream().map(x -> x.getId()).collect(Collectors.toList());
-
- if (currentConfigNodeIds.equals(targetConfigNodeIds)
- & currentConfigRelationIds.equals(targetConfigRelationIds)) {
- MBEventHandler.LOG.debug("Current configuration is equal to target configuration, no adaptation is needed");
- return;
- }
-
-
-
- final WSDLEndpoint endpoint = getAdaptationPlanEndpoint(currentConfigNodeIds, currentConfigRelationIds,
- targetConfigNodeIds, targetConfigRelationIds);
- final String correlationID = String.valueOf(System.currentTimeMillis());
- QName planId = null;
- PlanType planType = null;
- Map inputs = null;
-
- if (endpoint != null) {
- planId = endpoint.getPlanId();
- planType = PlanType.fromString(endpoint.getMetadata().get("PLANTYPE"));
-
- inputs = new HashMap<>();
-
- for (final String input : toStringCollection(endpoint.getMetadata().get("INPUTS"), ",")) {
- inputs.put(input, null);
- }
-
- } else {
- try {
- final BPELPlan adaptationPlan =
- (BPELPlan) importer.generateAdaptationPlan(instance.getCsarId(), instance.getTemplateId(),
- currentConfigNodeIds, currentConfigRelationIds,
- targetConfigNodeIds, targetConfigRelationIds);
-
- planType = PlanType.fromString(adaptationPlan.getType().getString());
- inputs = createInput(adaptationPlan);
- final Path tempFile = Files.createTempFile(adaptationPlan.getId(), ".zip");
- exporter.exportToPlanFile(tempFile.toUri(), adaptationPlan);
- final BpelPlanEnginePlugin deployPlugin = getBpelDeployPlugin();
-
- final Map endpointMetadata =
- toEndpointMetadata(currentConfigNodeIds, currentConfigRelationIds, targetConfigNodeIds,
- targetConfigRelationIds);
-
- endpointMetadata.put("PLANTYPE", planType.toString());
- endpointMetadata.put("INPUTS", toCSV(inputs.keySet()));
-
- planId = new QName(tempFile.getFileName().toString());
- deployPlugin.deployPlanFile(tempFile, instance.getCsarId(), planId, endpointMetadata);
- }
- catch (final SystemException e) {
- LOG.error("Internal error", e);
- return;
- }
- catch (final IOException e) {
- LOG.error("Couldn't read files", e);
- return;
- }
- catch (final JAXBException e) {
- LOG.error("Couldn't parse files", e);
- return;
- }
- }
-
- final Map requestBody = createRequestBody(instance.getCsarId(), instance.getTemplateId(),
- instance.getId(), inputs, correlationID);
-
- final ConsumerTemplate consumer =
- invokePlan("adapt", correlationID, true, instance.getId(), instance.getTemplateId(), requestBody,
- instance.getCsarId(), planId, BPELNS);
-
- // Threaded reception of response
- this.executor.submit(() -> {
-
- Object response = null;
-
- try {
- consumer.start();
- final Exchange exchange = consumer.receive("direct:response" + correlationID);
- response = exchange.getIn().getBody();
- consumer.stop();
- }
- catch (final Exception e) {
- MBEventHandler.LOG.error("Error occured: {}", e.getMessage(), e);
- return;
- }
-
- MBEventHandler.LOG.debug("Received response for request with id {}.", correlationID);
-
- final Map responseMap = new HashMap<>();
- responseMap.put("RESPONSE", response);
- responseMap.put("MESSAGEID", correlationID);
- responseMap.put("PLANLANGUAGE", BPELNS);
- final Event responseEvent = new Event("org_opentosca_situationadaptation/responses", responseMap);
-
- MBEventHandler.LOG.debug("Posting response as OSGi event.");
- this.eventAdmin.postEvent(responseEvent);
- });
-
- }
- }
-
- private WSDLEndpoint getAdaptationPlanEndpoint(final Collection sourceNodeIDs,
- final Collection sourceRelationIDs,
- final Collection targetNodeIDs,
- final Collection targetRelationIDs) {
- final ICoreEndpointService endpointService = getEndpointService();
- for (final WSDLEndpoint endpoint : endpointService.getWSDLEndpoints()) {
- final Collection sourceNodesMetadata =
- toStringCollection(endpoint.getMetadata().get("SOURCENODES"), ",");
- final Collection sourceRelationsMetadata =
- toStringCollection(endpoint.getMetadata().get("SOURCERELATIONS"), ",");
- final Collection targetNodesMetadata =
- toStringCollection(endpoint.getMetadata().get("TARGETNODES"), ",");
- final Collection targetRelationsMetadata =
- toStringCollection(endpoint.getMetadata().get("TARGETRELATIONS"), ",");
-
- if (sourceNodeIDs.equals(sourceNodesMetadata) && sourceRelationIDs.equals(sourceRelationsMetadata)
- && targetNodeIDs.equals(targetNodesMetadata) && targetRelationIDs.equals(targetRelationsMetadata)) {
- return endpoint;
- }
- }
-
- return null;
- }
-
- private Map toEndpointMetadata(final Collection sourceNodeIDs,
- final Collection sourceRelationIDs,
- final Collection targetNodeIDs,
- final Collection targetRelationIDs) {
- final Map result = new HashMap<>();
-
- result.put("SOURCENODES", toCSV(sourceNodeIDs));
- result.put("SOURCERELATIONS", toCSV(sourceRelationIDs));
- result.put("TARGETNODES", toCSV(targetNodeIDs));
- result.put("TARGETRELATIONS", toCSV(targetRelationIDs));
-
- return result;
- }
-
- private Collection toStringCollection(final String data, final String separator) {
- final Collection result = new ArrayList<>();
-
- if (data == null || data.isEmpty()) {
- return result;
- }
-
- final String[] split = data.split(separator);
-
- for (final String part : split) {
- if (part != null && !part.equals("") && !part.isEmpty()) {
- result.add(part);
- }
- }
-
- return result;
- }
-
- private String toCSV(final Collection strings) {
- return strings.stream().collect(Collectors.joining(","));
- }
-
- private Set toPlanInstanceInputs(final Map inputs) {
- final Set result = new HashSet<>();
- inputs.forEach((key, value) -> result.add(new PlanInstanceInput(key, value, "string")));
- return result;
- }
-
- private Map createInput(final BPELPlan plan) {
- final Collection inputs = plan.getWsdl().getInputMessageLocalNames();
-
- final Map result = new HashMap<>();
-
- for (final String input : inputs) {
- result.put(input, null);
- }
-
- return result;
- }
-
- private BpelPlanEnginePlugin getBpelDeployPlugin() {
- final BundleContext ctx = Activator.ctx;
- try {
- final ServiceReference>[] refs =
- ctx.getAllServiceReferences(IPlanEnginePlanRefPluginService.class.getName(), null);
- if (refs != null) {
- for (final ServiceReference> ref : refs) {
- final IPlanEnginePlanRefPluginService plugin =
- (IPlanEnginePlanRefPluginService) ctx.getService(ref);
- if (plugin instanceof BpelPlanEnginePlugin) {
- return (BpelPlanEnginePlugin) plugin;
- }
- }
- }
- }
- catch (final InvalidSyntaxException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- return null;
- }
- return null;
- }
-
- private ICoreEndpointService getEndpointService() {
- final BundleContext ctx = Activator.ctx;
- try {
- final ServiceReference>[] refs = ctx.getAllServiceReferences(ICoreEndpointService.class.getName(), null);
- if (refs != null) {
- for (final ServiceReference> ref : refs) {
- final ICoreEndpointService plugin = (ICoreEndpointService) ctx.getService(ref);
- return plugin;
- }
- }
- }
- catch (final InvalidSyntaxException e) {
- LOG.error("Couldn't fetch ICoreEndpointService instance", e);
- }
-
- return null;
- }
-
- private ServiceTemplateInstanceConfiguration getCurrentServiceTemplateInstanceConfiguration(final AbstractTopologyTemplate topology,
- final ServiceTemplateInstance instance) {
-
- final Collection currentlyRunningNodes = new HashSet<>();
- final Collection currentlyRunningRelations = new HashSet<>();
-
- final Collection validNodeState = new HashSet<>();
- validNodeState.add(NodeTemplateInstanceState.STARTED);
- validNodeState.add(NodeTemplateInstanceState.CREATED);
- validNodeState.add(NodeTemplateInstanceState.CONFIGURED);
-
- final Collection validRelationState = new HashSet<>();
- validRelationState.add(RelationshipTemplateInstanceState.CREATED);
-
- for (final AbstractNodeTemplate node : topology.getNodeTemplates()) {
- for (final NodeTemplateInstance inst : instance.getNodeTemplateInstances()) {
- if (inst.getTemplateId().getLocalPart().equals(node.getId())
- && validNodeState.contains(inst.getState())) {
- currentlyRunningNodes.add(node);
- }
- }
- }
-
- for (final AbstractRelationshipTemplate relation : topology.getRelationshipTemplates()) {
- for (final RelationshipTemplateInstance inst : instance.getRelationshipTemplateInstances()) {
- if (inst.getTemplateId().getLocalPart().equals(relation.getId())
- && validRelationState.contains(inst.getState())) {
- currentlyRunningRelations.add(relation);
- }
- }
- }
-
- return new ServiceTemplateInstanceConfiguration(currentlyRunningNodes, currentlyRunningRelations);
- }
-
- private ServiceTemplateInstanceConfiguration getValidServiceTemplateInstanceConfiguration(final AbstractTopologyTemplate topology,
- final Map> nodeIds2situationIds) {
-
-
- final Collection validNodes = new ArrayList<>();
- final Collection validRelations = new ArrayList<>();
-
- for (final AbstractNodeTemplate nodeTemplate : topology.getNodeTemplates()) {
- final Collection policies = getPolicies(Types.situationPolicyType, nodeTemplate);
- if (policies.isEmpty()) {
- validNodes.add(nodeTemplate);
- } else if (isValidUnderSituations(nodeTemplate, nodeIds2situationIds)) {
- validNodes.add(nodeTemplate);
- }
- }
-
- // check if node set is deployable
- final Collection deployableAndValidNodeSet =
- getDeployableSubgraph(validNodes, nodeIds2situationIds);
- for (final AbstractRelationshipTemplate relations : topology.getRelationshipTemplates()) {
- if (deployableAndValidNodeSet.contains(relations.getSource())
- & deployableAndValidNodeSet.contains(relations.getTarget())) {
- validRelations.add(relations);
- }
- }
-
- return new ServiceTemplateInstanceConfiguration(deployableAndValidNodeSet, validRelations);
- }
-
- private Collection getDeployableSubgraph(final Collection nodeTemplates,
- final Map> nodeIds2situationIds) {
- final Set validDeploymentSubgraph = new HashSet<>(nodeTemplates);
- final Collection toRemove = new HashSet<>();
-
- for (final AbstractNodeTemplate nodeTemplate : nodeTemplates) {
- final Collection hostingRelations =
- getOutgoingHostedOnRelations(nodeTemplate);
- if (!hostingRelations.isEmpty()) {
- // if we have hostedOn relations check if it is valid under the situation and is in the set
- boolean foundValidHost = false;
- for (final AbstractRelationshipTemplate relationshipTemplate : hostingRelations) {
- final AbstractNodeTemplate hostingNode = relationshipTemplate.getTarget();
- if (isValidUnderSituations(hostingNode, nodeIds2situationIds)
- && nodeTemplates.contains(hostingNode)) {
- foundValidHost = true;
- break;
- }
- }
- if (!foundValidHost) {
- toRemove.add(nodeTemplate);
- }
- }
- }
-
- if (toRemove.isEmpty()) {
- return validDeploymentSubgraph;
- } else {
- validDeploymentSubgraph.removeAll(toRemove);
- return getDeployableSubgraph(validDeploymentSubgraph, nodeIds2situationIds);
- }
- }
-
- private boolean isValidUnderSituations(final AbstractNodeTemplate nodeTemplate,
- final Map> nodeIds2situationIds) {
- // check if the situation of the policy is active
- Collection situationIds = null;
-
- if ((situationIds = nodeIds2situationIds.get(nodeTemplate.getId())) == null) {
- return true;
- }
-
-
- boolean isValid = true;
- for (final Long sitId : situationIds) {
- isValid &= isSituationActive(sitId);
- }
- return isValid;
- }
-
- private Collection getOutgoingHostedOnRelations(final AbstractNodeTemplate nodeTemplate) {
- return nodeTemplate.getOutgoingRelations().stream().filter(x -> x.getType().equals(Types.hostedOnRelationType))
- .collect(Collectors.toList());
- }
-
-
-
- private Collection getPolicies(final QName policyType, final AbstractNodeTemplate nodeTemplate) {
- return nodeTemplate.getPolicies().stream().filter(x -> x.getType().getId().equals(policyType))
- .collect(Collectors.toList());
- }
-
- private static class ServiceTemplateInstanceConfiguration {
- Collection nodeTemplates;
- Collection relationshipTemplates;
-
- public ServiceTemplateInstanceConfiguration(final Collection nodes,
- final Collection relations) {
- this.nodeTemplates = nodes;
- this.relationshipTemplates = relations;
- }
- }
-
- private boolean isSituationActive(final Long situationId) {
- return getSituationRepository().find(situationId).get().isActive();
- }
-
- private SituationRepository getSituationRepository() {
- return new SituationRepository();
- }
-
- public Map createRequestBody(final CSARID csarID, final QName serviceTemplateID,
- final Long serviceTemplateInstanceId,
- final Map inputParameter, final String correlationID) {
-
- final Map map = new HashMap<>();
-
-
- LOG.trace("Processing a list of {} parameters", inputParameter.size());
- for (final String para : inputParameter.keySet()) {
- final String value = inputParameter.get(para);
- LOG.trace("Put in the parameter {} with value \"{}\".", para, value);
- if (para.equalsIgnoreCase("CorrelationID")) {
- LOG.debug("Found Correlation Element! Put in CorrelationID \"" + correlationID + "\".");
- map.put(para, correlationID);
- } else if (para.equalsIgnoreCase("csarID")) {
- LOG.debug("Found csarID Element! Put in csarID \"" + csarID + "\".");
- map.put(para, csarID.toString());
- } else if (para.equalsIgnoreCase("serviceTemplateID")) {
- LOG.debug("Found serviceTemplateID Element! Put in serviceTemplateID \"" + serviceTemplateID + "\".");
- map.put(para, serviceTemplateID.toString());
- } else if (para.equalsIgnoreCase("OpenTOSCAContainerAPIServiceInstanceURL")
- & serviceTemplateInstanceId != null) {
- final String serviceTemplateInstanceUrl =
- createServiceInstanceURI(csarID, serviceTemplateID, serviceTemplateInstanceId);
- map.put(para, String.valueOf(serviceTemplateInstanceUrl));
- } else if (para.equalsIgnoreCase("containerApiAddress")) {
- LOG.debug("Found containerApiAddress Element! Put in containerApiAddress \""
- + Settings.CONTAINER_API_LEGACY + "\".");
- map.put(para, Settings.CONTAINER_API_LEGACY);
- } else if (para.equalsIgnoreCase("instanceDataAPIUrl")) {
- LOG.debug("Found instanceDataAPIUrl Element! Put in instanceDataAPIUrl \""
- + Settings.CONTAINER_INSTANCEDATA_API + "\".");
- String str = Settings.CONTAINER_INSTANCEDATA_API;
- str = str.replace("{csarid}", csarID.getFileName());
- try {
- str = str.replace("{servicetemplateid}",
- URLEncoder.encode(URLEncoder.encode(serviceTemplateID.toString(), "UTF-8"),
- "UTF-8"));
- }
- catch (final UnsupportedEncodingException e) {
- LOG.error("Couldn't encode Service Template URL", e);
- }
- LOG.debug("instance api: {}", str);
- map.put(para, str);
- } else if (para.equalsIgnoreCase("csarEntrypoint")) {
- LOG.debug("Found csarEntrypoint Element! Put in instanceDataAPIUrl \""
- + Settings.CONTAINER_API_LEGACY + "/" + csarID + "\".");
- map.put(para, Settings.CONTAINER_API_LEGACY + "/CSARs/" + csarID);
- } else {
- map.put(para, value);
- }
- }
-
- return map;
- }
-
- private String createServiceInstanceURI(final CSARID csarId, final QName serviceTemplate,
- final Long serviceTemplateInstanceId) {
- String url = Settings.CONTAINER_INSTANCEDATA_API + "/" + serviceTemplateInstanceId;
- url = url.replace("{csarid}", csarId.getFileName());
- url = url.replace("{servicetemplateid}",
- UriComponent.encode(UriComponent.encode(serviceTemplate.toString(),
- UriComponent.Type.PATH_SEGMENT),
- UriComponent.Type.PATH_SEGMENT));
-
- return url;
- }
-
-
- public void bindEventAdmin(final EventAdmin eventAdmin) {
- this.eventAdmin = eventAdmin;
- }
-
- public void unbindEventAdmin(final EventAdmin eventAdmin) {
- try {
- this.executor.shutdown();
- this.executor.awaitTermination(5, TimeUnit.SECONDS);
- }
- catch (final InterruptedException e) {
- // Ignore
- }
- finally {
- this.executor.shutdownNow();
- }
- this.eventAdmin = null;
- }
-}
diff --git a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/OsgiEventOperations.java b/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/OsgiEventOperations.java
deleted file mode 100644
index 686f32b9a..000000000
--- a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/OsgiEventOperations.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.opentosca.bus.management.api.osgievent;
-
-/**
- * This enum defines the operations which can be invoked through the OSGi-Event API of the
- * Management Bus. The enum is used by the route to forward the invocations to the correct receiver.
- */
-public enum OsgiEventOperations {
-
- INVOKE_PLAN("invokePlan"), INVOKE_IA("invokeIA");
-
- private final String headerValue;
-
- private OsgiEventOperations(final String headerValue) {
- this.headerValue = headerValue;
- }
-
- public String getHeaderValue() {
- return this.headerValue;
- }
-}
diff --git a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/package-info.java b/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/package-info.java
deleted file mode 100644
index 2a22a06c6..000000000
--- a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/package-info.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * This package contains the activator for starting the camel context and with it the routes of the
- * Management Bus-OSGI/EVENT-API as well as the event handler that handles the incoming and outgoing
- * osgi events.
- *
- * Copyright 2012 IAAS University of Stuttgart
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- */
-package org.opentosca.bus.management.api.osgievent;
diff --git a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/route/Route.java b/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/route/Route.java
deleted file mode 100644
index a5fa2af55..000000000
--- a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/route/Route.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.opentosca.bus.management.api.osgievent.route;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.opentosca.bus.management.api.osgievent.Activator;
-import org.opentosca.bus.management.api.osgievent.OsgiEventOperations;
-import org.opentosca.bus.management.header.MBHeader;
-
-/**
- * Route of the Management Bus-OSGiEvent-API.
- *
- *
- * Copyright 2013 IAAS University of Stuttgart
- *
- *
- * Incoming events are given here from the EventHandler to be routed to the Management Bus for
- * further processing. The response message is given back to the EventHandler.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Route extends RouteBuilder {
-
- @Override
- public void configure() throws Exception {
-
- // Management Bus Endpoints
- final String MANAGEMENT_BUS_IA =
- "bean:org.opentosca.bus.management.service.IManagementBusService?method=invokeIA";
- final String MANAGEMENT_BUS_PLAN =
- "bean:org.opentosca.bus.management.service.IManagementBusService?method=invokePlan";
-
- this.from("direct:invoke").to("stream:out").process(exchange -> {
-
- exchange.getIn().setHeader(MBHeader.APIID_STRING.toString(), Activator.apiID);
-
- final String messageID =
- exchange.getIn().getHeader(MBHeader.PLANCORRELATIONID_STRING.toString(), String.class);
- if (messageID != null) {
- exchange.getIn().setMessageId(messageID);
- exchange.getIn().setHeader(MBHeader.SYNCINVOCATION_BOOLEAN.toString(), false);
- } else {
- exchange.getIn().setHeader(MBHeader.SYNCINVOCATION_BOOLEAN.toString(), true);
- }
-
- }).to("stream:out").choice().when(header("OPERATION").isEqualTo(OsgiEventOperations.INVOKE_IA.getHeaderValue()))
- .to("direct:invokeIA").when(header("OPERATION").isEqualTo(OsgiEventOperations.INVOKE_PLAN.getHeaderValue()))
- .to("direct:invokePlan").end();
-
- this.from("direct:invokeIA").to("stream:out").wireTap(MANAGEMENT_BUS_IA);
- this.from("direct:invokePlan").to("stream:out").to(MANAGEMENT_BUS_PLAN).end();
-
- this.from("direct-vm:" + Activator.apiID).recipientList(this.simple("direct:response${id}")).end();
-
- }
-
-}
diff --git a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/route/package-info.java b/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/route/package-info.java
deleted file mode 100644
index ee36d17dd..000000000
--- a/org.opentosca.bus.management.api.osgievent/src/org/opentosca/bus/management/api/osgievent/route/package-info.java
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * This package contains the camel routes of the Management Bus-OSGI/EVENT-API.
- *
- * Copyright 2012 IAAS University of Stuttgart
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- */
-package org.opentosca.bus.management.api.osgievent.route;
diff --git a/org.opentosca.bus.management.api.resthttp/META-INF/MANIFEST.MF b/org.opentosca.bus.management.api.resthttp/META-INF/MANIFEST.MF
deleted file mode 100644
index 7e49e2483..000000000
--- a/org.opentosca.bus.management.api.resthttp/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Rest-Http API for Management Bus
-Bundle-SymbolicName: org.opentosca.bus.management.api.resthttp
-Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.opentosca.bus.management.api.resthttp.Activator
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.apache.camel;version="2.10.4",
- org.apache.camel.builder;version="2.10.4",
- org.apache.camel.component.restlet;version="2.10.4",
- org.apache.camel.core.osgi;version="2.10.4",
- org.apache.camel.impl;version="2.10.4",
- org.apache.camel.model;version="2.10.4",
- org.apache.camel.spi;version="2.10.4",
- org.json.simple,
- org.json.simple.parser,
- org.osgi.framework;version="1.6.0",
- org.restlet,
- org.restlet.data,
- org.restlet.util,
- org.slf4j;version="1.7.5"
-Require-Bundle: org.opentosca.container.core;bundle-version="1.0.0",
- org.opentosca.bus.management;bundle-version="1.0.0"
diff --git a/org.opentosca.bus.management.api.resthttp/build.properties b/org.opentosca.bus.management.api.resthttp/build.properties
deleted file mode 100644
index a12d47e56..000000000
--- a/org.opentosca.bus.management.api.resthttp/build.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .
diff --git a/org.opentosca.bus.management.api.resthttp/pom.xml b/org.opentosca.bus.management.api.resthttp/pom.xml
deleted file mode 100644
index 122f5d141..000000000
--- a/org.opentosca.bus.management.api.resthttp/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.management.api.resthttp
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/Activator.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/Activator.java
deleted file mode 100644
index c1f0a184b..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/Activator.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.opentosca.bus.management.api.resthttp;
-
-import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
-import org.apache.camel.core.osgi.OsgiServiceRegistry;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.opentosca.bus.management.api.resthttp.route.DeleteRoute;
-import org.opentosca.bus.management.api.resthttp.route.GetResultRoute;
-import org.opentosca.bus.management.api.resthttp.route.InvocationRoute;
-import org.opentosca.bus.management.api.resthttp.route.IsFinishedRoute;
-import org.opentosca.bus.management.api.resthttp.route.OptionsRoute;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Activator of the Management Bus REST-API.
- *
- *
- * The activator is needed to add and start the camel routes.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class Activator implements BundleActivator {
-
- final private static Logger LOG = LoggerFactory.getLogger(Activator.class);
-
- public static String apiID;
-
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
-
- Activator.apiID = bundleContext.getBundle().getSymbolicName();
- final DefaultCamelContext camelContext = new OsgiDefaultCamelContext(bundleContext);
-
- camelContext.addRoutes(new InvocationRoute());
- camelContext.addRoutes(new GetResultRoute());
- camelContext.addRoutes(new IsFinishedRoute());
- camelContext.addRoutes(new DeleteRoute());
- camelContext.addRoutes(new OptionsRoute());
-
- camelContext.start();
-
- Activator.LOG.info("Management Bus REST API started!");
- }
-
- @Override
- public void stop(final BundleContext arg0) throws Exception {
-
- Activator.LOG.info("Management Bus REST API stopped!");
- }
-
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/model/QueueMap.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/model/QueueMap.java
deleted file mode 100644
index bb516dd78..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/model/QueueMap.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.model;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Map that manages the status of the requests. RequestID is used as key of the map. The
- * value of the map indicates if the invocation has finished or not.
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class QueueMap {
-
- final private static Logger LOG = LoggerFactory.getLogger(QueueMap.class);
-
- private static ConcurrentHashMap queue = new ConcurrentHashMap<>();
-
- /**
- * Inserts an entry into the queue (if not already existing) and set it to finished.
- *
- * @param id of the request
- */
- public static void finished(final String id) {
-
- QueueMap.LOG.debug("Request with ID: {} has finished.", id);
-
- queue.put(id, true);
- }
-
- /**
- * Inserts an entry into the queue and set it to notFinished. Only if the id not already exists.
- *
- * @param id of the request
- */
- public static void notFinished(final String id) {
-
- QueueMap.LOG.debug("Request with ID: {} hasn't finished yet.", id);
-
- queue.putIfAbsent(id, false);
- }
-
- /**
- * Inserts an entry into the queue.
- *
- * @param id of the request
- * @param isFinished specifies if the invocation has finished or not
- */
- public static void put(final String id, final Boolean isFinished) {
-
- QueueMap.LOG.debug("RequestID: {}, isFinished: {}", id, isFinished);
-
- queue.put(id, isFinished);
- }
-
- /**
- * @param id of the request
- * @return true if the invocation has finished. Otherwise false
- */
- public static boolean hasFinished(final String id) {
-
- return queue.get(id);
- }
-
- /**
- * @param id of the request
- * @return true if the queue contains the specified requestID. Otherwise false
- */
- public static boolean containsID(final String id) {
- return queue.containsKey(id);
- }
-
- /**
- * Removes the entry with the specified requestID from the queue.
- *
- * @param id of the request
- */
- public static void remove(final String id) {
- queue.remove(id);
- }
-
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/model/RequestID.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/model/RequestID.java
deleted file mode 100644
index f4e2e14b4..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/model/RequestID.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.model;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- *
- * Manages the requestIDs needed to correlate the invocation-requests, the isFinished-requests as
- * well as the getResult-requests.
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class RequestID {
-
- private static AtomicLong incrementer = new AtomicLong(0);
-
- /**
- * @return requestID
- */
- public synchronized static String getNextID() {
-
- final Long id = incrementer.getAndIncrement();
-
- // Prototype:
- // For the unlikely case, that MAX_Value is reached, begin with 0
- // again. Assumption: old requests were processed in the
- // mean time.
- if (id == Long.MAX_VALUE) {
- incrementer.set(0);
- }
-
- return Long.toString(id);
- }
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/model/ResultMap.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/model/ResultMap.java
deleted file mode 100644
index 9b0fdc9be..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/model/ResultMap.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.model;
-
-import java.util.HashMap;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- *
- * Map that manages the invocation results. RequestID is used as key of the map. The
- * value of the map is the result of the invocation. Or null if the invocation
- * failed.
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class ResultMap {
-
- private static ConcurrentHashMap> invocations = new ConcurrentHashMap<>();
-
- /**
- * @param id of the request
- * @param result of the invocation.
- */
- public static void put(final String id, final HashMap result) {
- invocations.put(id, result);
- }
-
- /**
- * @param id
- * @return result of the invocation. Void if the invoked method was of return type
- * void. null if the invocation failed.
- */
- public static HashMap get(final String id) {
- return invocations.get(id);
- }
-
- /**
- * @param id of the request
- * @return true if the map contains the specified requestID. Otherwise false
- */
- public static boolean containsID(final String id) {
- return invocations.containsKey(id);
- }
-
- /**
- * Removes the entry with the specified requestID from the map.
- *
- * @param id of the request
- */
- public static void remove(final String id) {
- invocations.remove(id);
- }
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/ExceptionProcessor.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/ExceptionProcessor.java
deleted file mode 100644
index edc37a33b..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/ExceptionProcessor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.restlet.RestletConstants;
-import org.json.simple.parser.ParseException;
-import org.restlet.Response;
-import org.restlet.data.MediaType;
-import org.restlet.data.Status;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * ExceptionProcessor of the Management Bus REST-API.
- *
- *
- * This processor handles the exceptions and sends a reasonable response back to the caller.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class ExceptionProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(ExceptionProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- ExceptionProcessor.LOG.debug("Exception handling...");
-
- final Response response = exchange.getIn().getHeader(RestletConstants.RESTLET_RESPONSE, Response.class);
-
- if (exchange.getIn().getBody() instanceof ParseException) {
- response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
- final String body = exchange.getIn().getBody(String.class);
- response.setEntity("JSON is not valid: " + body, MediaType.TEXT_ALL);
- ExceptionProcessor.LOG.warn("JSON is not valid: {}", body);
- }
-
- else if (exchange.getIn().getBody() instanceof NullPointerException) {
- response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
- response.setEntity("Needed information not specified.", MediaType.TEXT_ALL);
- ExceptionProcessor.LOG.warn("Needed information not specified.");
-
- } else if (exchange.getIn().getBody() instanceof Exception) {
- response.setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
- response.setEntity("Invocation failed! " + exchange.getIn().getBody().toString(), MediaType.TEXT_ALL);
- ExceptionProcessor.LOG.warn("Invocation failed! " + exchange.getIn().getBody().toString());
-
- }
-
- exchange.getOut().setBody(response);
-
- }
-
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/GetResultProcessor.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/GetResultProcessor.java
deleted file mode 100644
index 694fc0b76..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/GetResultProcessor.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.processor;
-
-import java.util.HashMap;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.opentosca.bus.management.api.resthttp.model.QueueMap;
-import org.opentosca.bus.management.api.resthttp.model.ResultMap;
-import org.opentosca.bus.management.api.resthttp.route.DeleteRoute;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * GetResultProcessor of the Management Bus.
- *
- *
- * This processor handles "getResult" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class GetResultProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(GetResultProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- final String requestID = exchange.getIn().getBody(String.class);
-
- GetResultProcessor.LOG.debug("getResult request received. RequestID: {}", requestID);
-
- if (ResultMap.containsID(requestID)) {
-
- GetResultProcessor.LOG.debug("Getting result.");
-
- final HashMap result = ResultMap.get(requestID);
-
- if (DeleteRoute.AUTO_DELETE) {
- // "Garbage collection": Remove polled responses.
- ResultMap.remove(requestID);
- QueueMap.remove(requestID);
- }
-
- exchange.getIn().setBody(result);
-
- } else if (!QueueMap.containsID(requestID)) {
- GetResultProcessor.LOG.warn("Unknown RequestID: {}", requestID);
- exchange.getIn().setBody(new Exception("Unknown RequestID: " + requestID));
- } else {
- GetResultProcessor.LOG.warn("Error while invoking specified method.");
- exchange.getIn().setBody(new Exception("Error while invoking specified method."));
- }
-
- }
-
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/GetResultRequestProcessor.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/GetResultRequestProcessor.java
deleted file mode 100644
index 42a6d7c1b..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/GetResultRequestProcessor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.opentosca.bus.management.api.resthttp.route.InvocationRoute;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * GetResultRequestProcessor of the Management Bus REST-API.
- *
- *
- * This processor handles "getResult" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class GetResultRequestProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(GetResultRequestProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- GetResultRequestProcessor.LOG.debug("Processing GetResult request....");
-
- final Integer requestID = exchange.getIn().getHeader(InvocationRoute.ID, Integer.class);
-
- GetResultRequestProcessor.LOG.debug("RequestID: {}", requestID);
-
- exchange.getIn().setBody(requestID);
-
- }
-
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/GetResultResponseProcessor.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/GetResultResponseProcessor.java
deleted file mode 100644
index c3b38b91f..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/GetResultResponseProcessor.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.processor;
-
-import java.util.HashMap;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.restlet.RestletConstants;
-import org.json.simple.JSONObject;
-import org.opentosca.bus.management.api.resthttp.route.InvocationRoute;
-import org.restlet.Response;
-import org.restlet.data.MediaType;
-import org.restlet.data.Status;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * GetResultResponseProcessor of the Management Bus REST-API.
- *
- *
- * This processor handles the responses of "getResult" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class GetResultResponseProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(GetResultResponseProcessor.class);
-
- @SuppressWarnings("unchecked")
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- GetResultResponseProcessor.LOG.debug("Processing GetResult response....");
-
- final String requestID = exchange.getIn().getHeader(InvocationRoute.ID, String.class);
-
- GetResultResponseProcessor.LOG.debug("RequestID: {}", requestID);
-
- final Response response = exchange.getIn().getHeader(RestletConstants.RESTLET_RESPONSE, Response.class);
-
- if (exchange.getIn().getBody() instanceof Exception) {
-
- response.setStatus(Status.CLIENT_ERROR_NOT_FOUND);
- response.setEntity(exchange.getIn().getBody(String.class), MediaType.TEXT_ALL);
-
- } else {
-
- final HashMap responseMap = exchange.getIn().getBody(HashMap.class);
-
- final JSONObject obj = new JSONObject();
- obj.put("response", responseMap);
-
- response.setStatus(Status.SUCCESS_OK);
- response.setEntity(obj.toJSONString(), MediaType.APPLICATION_JSON);
-
- }
-
- exchange.getOut().setBody(response);
-
- }
-
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/InvocationRequestProcessor.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/InvocationRequestProcessor.java
deleted file mode 100644
index 4488fddd1..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/InvocationRequestProcessor.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.processor;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.json.simple.parser.ContainerFactory;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
-import org.opentosca.bus.management.api.resthttp.Activator;
-import org.opentosca.bus.management.header.MBHeader;
-import org.opentosca.container.core.model.csar.id.CSARID;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * InvocationRequestProcessor of the Management Bus REST-API.
- *
- *
- * This processor handles "invokeOperation" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class InvocationRequestProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(InvocationRequestProcessor.class);
-
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- String nodeTemplateID = null;
- String relationshipTemplateID = null;
-
- InvocationRequestProcessor.LOG.debug("Processing Invocation request...");
-
- final String bodyString = exchange.getIn().getBody(String.class);
-
- final LinkedHashMap> requestMap = this.requestToMap(bodyString);
-
- final LinkedHashMap infosMap = requestMap.get("invocation-information");
-
- if (infosMap != null) {
-
- if (infosMap.containsKey("csarID")) {
- final String csarID = infosMap.get("csarID");
- InvocationRequestProcessor.LOG.debug("csarID: {}", csarID);
- exchange.getIn().setHeader(MBHeader.CSARID.toString(), new CSARID(csarID));
-
- } else {
- InvocationRequestProcessor.LOG.debug("Can't process request: csarID is missing!");
- throw new Exception("Can't process request: csarID is missing!");
- }
- if (infosMap.containsKey("serviceTemplateID")) {
- final QName serviceTemplateID = QName.valueOf(infosMap.get("serviceTemplateID"));
- InvocationRequestProcessor.LOG.debug("serviceTemplateID: {}", serviceTemplateID);
- exchange.getIn().setHeader(MBHeader.SERVICETEMPLATEID_QNAME.toString(), serviceTemplateID);
-
- } else {
- InvocationRequestProcessor.LOG.debug("Can't process request: serviceTemplateID is missing!");
- throw new Exception("Can't process request: serviceTemplateID is missing!");
- }
- if (infosMap.containsKey("serviceInstanceID")) {
- final String serviceInstanceID = infosMap.get("serviceInstanceID");
- InvocationRequestProcessor.LOG.debug("serviceInstanceID: {}", serviceInstanceID);
-
- if (serviceInstanceID != null) {
- final URI serviceInstanceURI = new URI(serviceInstanceID);
- exchange.getIn().setHeader(MBHeader.SERVICEINSTANCEID_URI.toString(), serviceInstanceURI);
- }
- }
- if (infosMap.containsKey("nodeInstanceID")) {
- final String nodeInstanceID = infosMap.get("nodeInstanceID");
- InvocationRequestProcessor.LOG.debug("nodeInstanceID: {}", nodeInstanceID);
- exchange.getIn().setHeader(MBHeader.NODEINSTANCEID_STRING.toString(), nodeInstanceID);
-
- }
- if (infosMap.containsKey("nodeTemplateID")) {
- nodeTemplateID = infosMap.get("nodeTemplateID");
- InvocationRequestProcessor.LOG.debug("nodeTemplateID: {}", nodeTemplateID);
- exchange.getIn().setHeader(MBHeader.NODETEMPLATEID_STRING.toString(), nodeTemplateID);
- } else if (infosMap.containsKey("relationshipTemplateID")) {
- relationshipTemplateID = infosMap.get("relationshipTemplateID");
- InvocationRequestProcessor.LOG.debug("relationshipTemplateID: {}", relationshipTemplateID);
- exchange.getIn().setHeader(MBHeader.RELATIONSHIPTEMPLATEID_STRING.toString(), relationshipTemplateID);
- }
- if (infosMap.containsKey("interface")) {
- final String interfaceName = infosMap.get("interface");
- InvocationRequestProcessor.LOG.debug("interface: {}", interfaceName);
- exchange.getIn().setHeader(MBHeader.INTERFACENAME_STRING.toString(), interfaceName);
- } else {
- InvocationRequestProcessor.LOG.debug("Can't process request: interface is missing!");
- throw new Exception("Can't process request: interface is missing!");
- }
- if (infosMap.containsKey("operation")) {
- final String operationName = infosMap.get("operation");
- InvocationRequestProcessor.LOG.debug("operationName: {}", operationName);
- exchange.getIn().setHeader(MBHeader.OPERATIONNAME_STRING.toString(), operationName);
- } else {
- InvocationRequestProcessor.LOG.debug("Can't process request: operation is missing!");
- throw new Exception("Can't process request: operation is missing!");
- }
-
- if (nodeTemplateID == null && relationshipTemplateID == null) {
- InvocationRequestProcessor.LOG.debug("Can't process request: Eighter nodeTemplateID or relationshipTemplateID is required!");
- throw new Exception(
- "Can't process request: Eighter nodeTemplateID or relationshipTemplateID is required!");
- }
-
- final HashMap paramsMap = requestMap.get("params");
-
- if (paramsMap != null) {
-
- exchange.getIn().setBody(paramsMap);
- InvocationRequestProcessor.LOG.debug("Params: {}", paramsMap);
-
- } else {
- InvocationRequestProcessor.LOG.debug("No parameter specified.");
- }
-
- } else {
- InvocationRequestProcessor.LOG.warn("Needed information not specified.");
- throw new Exception("Needed information not specified.");
- }
-
- exchange.getIn().setHeader(MBHeader.APIID_STRING.toString(), Activator.apiID);
- }
-
- /**
- *
- * Parses and maps a json String to a
- * {@literal LinkedHashMap>}.
- *
- * @param request
- * @return LinkedHashMap
- * @throws IOException
- * @throws ParseException
- * @throws ApplicationBusInternalException
- */
- @SuppressWarnings("unchecked")
- private LinkedHashMap> requestToMap(final String body) throws ParseException {
-
- final ContainerFactory orderedKeyFactory = new ContainerFactory() {
-
- @Override
- public Map> createObjectContainer() {
- return new LinkedHashMap<>();
- }
-
- @Override
- public List> creatArrayContainer() {
- // TODO Auto-generated method stub
- return null;
- }
-
- };
-
- final JSONParser parser = new JSONParser();
-
- final Object obj = parser.parse(body, orderedKeyFactory);
-
- return (LinkedHashMap>) obj;
-
- }
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/InvocationResponseProcessor.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/InvocationResponseProcessor.java
deleted file mode 100644
index 68bd297fb..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/InvocationResponseProcessor.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.restlet.RestletConstants;
-import org.opentosca.bus.management.api.resthttp.route.InvocationRoute;
-import org.restlet.Response;
-import org.restlet.data.Status;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * InvocationResponseProcessor of the Management Bus REST-API.
- *
- *
- * This processor handles the responses of "invokeOperation" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class InvocationResponseProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(InvocationResponseProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- InvocationResponseProcessor.LOG.debug("Processing Invocation response....");
-
- final String requestID = exchange.getIn().getBody(String.class);
-
- InvocationResponseProcessor.LOG.debug("RequestID: {}", requestID);
-
- final Response response = exchange.getIn().getHeader(RestletConstants.RESTLET_RESPONSE, Response.class);
- response.setStatus(Status.SUCCESS_ACCEPTED);
- response.setLocationRef(InvocationRoute.POLL_ENDPOINT.replace(InvocationRoute.ID_PLACEHODLER, requestID));
-
- exchange.getOut().setBody(response);
-
- }
-
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/IsFinishedProcessor.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/IsFinishedProcessor.java
deleted file mode 100644
index f4fc56fda..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/IsFinishedProcessor.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.opentosca.bus.management.api.resthttp.model.QueueMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * IsFinishedProcessor of the Management Bus REST-API.
- *
- *
- * This processor handles "isFinished" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class IsFinishedProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(IsFinishedProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- final String requestID = exchange.getIn().getBody(String.class);
-
- IsFinishedProcessor.LOG.debug("Queue polling for RequestID: {}", requestID);
-
- if (QueueMap.containsID(requestID)) {
- IsFinishedProcessor.LOG.debug("RequestID is known.");
-
- if (QueueMap.hasFinished(requestID)) {
- IsFinishedProcessor.LOG.debug("Invocation has finished.");
- exchange.getIn().setBody(true);
-
- } else {
- IsFinishedProcessor.LOG.debug("Invocation has not finished yet.");
- exchange.getIn().setBody(false);
- }
- } else {
- IsFinishedProcessor.LOG.warn("Unknown RequestID: {}", requestID);
- exchange.getIn().setBody(new Exception("Unknown RequestID: " + requestID));
- }
-
- }
-
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/IsFinishedRequestProcessor.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/IsFinishedRequestProcessor.java
deleted file mode 100644
index 6cd2d0b56..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/IsFinishedRequestProcessor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.opentosca.bus.management.api.resthttp.route.InvocationRoute;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * IsFinishedRequestProcessor of the Management Bus REST-API.
- *
- *
- * This processor handles "isFinished" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class IsFinishedRequestProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(IsFinishedRequestProcessor.class);
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- IsFinishedRequestProcessor.LOG.debug("Processing IsFinished request....");
-
- final Integer requestID = exchange.getIn().getHeader(InvocationRoute.ID, Integer.class);
-
- IsFinishedRequestProcessor.LOG.debug("RequestID: {}", requestID);
-
- exchange.getIn().setBody(requestID);
-
- }
-
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/IsFinishedResponseProcessor.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/IsFinishedResponseProcessor.java
deleted file mode 100644
index e62670862..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/processor/IsFinishedResponseProcessor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.processor;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.restlet.RestletConstants;
-import org.json.simple.JSONObject;
-import org.opentosca.bus.management.api.resthttp.route.InvocationRoute;
-import org.restlet.Response;
-import org.restlet.data.MediaType;
-import org.restlet.data.Status;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * IsFinishedResponseProcessor of the Management Bus REST-API.
- *
- *
- * This processor handles the responses of "isFinished" requests.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class IsFinishedResponseProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(IsFinishedResponseProcessor.class);
-
- @SuppressWarnings("unchecked")
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- IsFinishedResponseProcessor.LOG.debug("Processing IsFinished response....");
-
- final String requestID = exchange.getIn().getHeader(InvocationRoute.ID, String.class);
-
- IsFinishedResponseProcessor.LOG.debug("RequestID: {}", requestID);
-
- final Response response = exchange.getIn().getHeader(RestletConstants.RESTLET_RESPONSE, Response.class);
-
- if (exchange.getIn().getBody() instanceof Exception) {
-
- response.setStatus(Status.CLIENT_ERROR_NOT_FOUND);
- response.setEntity(exchange.getIn().getBody(String.class), MediaType.TEXT_ALL);
-
- } else {
-
- final Boolean isFinished = exchange.getIn().getBody(Boolean.class);
-
- if (isFinished) {
- IsFinishedResponseProcessor.LOG.debug("Invocation has finished, send location of result.");
-
- response.setStatus(Status.REDIRECTION_SEE_OTHER);
- response.setLocationRef(InvocationRoute.GET_RESULT_ENDPOINT.replace(InvocationRoute.ID_PLACEHODLER,
- requestID));
-
- } else {
- IsFinishedResponseProcessor.LOG.debug("Invocation has not finished yet.");
-
- final JSONObject obj = new JSONObject();
- obj.put("status", "PENDING");
-
- response.setStatus(Status.SUCCESS_OK);
- response.setEntity(obj.toJSONString(), MediaType.APPLICATION_JSON);
-
- }
- exchange.getOut().setBody(response);
- }
- }
-
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/DeleteRoute.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/DeleteRoute.java
deleted file mode 100644
index ec06ab224..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/DeleteRoute.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.route;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.opentosca.bus.management.api.resthttp.model.QueueMap;
-import org.opentosca.bus.management.api.resthttp.model.ResultMap;
-
-/**
- * InvocationRoute of the Management Bus REST-API.
- *
- *
- * The "getResult" endpoint of the REST-API is created here.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class DeleteRoute extends RouteBuilder {
-
- // true => invocation results will be deleted automatically after fetching
- // the result
- // false => invocation result needs to be deleted manually
- public static final boolean AUTO_DELETE = false;
-
- @Override
- public void configure() throws Exception {
- from("restlet:" + InvocationRoute.BASE_ENDPOINT + InvocationRoute.GET_RESULT_ENDPOINT
- + "?restletMethods=delete").bean(QueueMap.class, "remove(${header." + InvocationRoute.ID + "})")
- .bean(ResultMap.class, "remove(${header." + InvocationRoute.ID + "})")
- .removeHeaders("*");
- }
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/GetResultRoute.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/GetResultRoute.java
deleted file mode 100644
index b893961f8..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/GetResultRoute.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.route;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.opentosca.bus.management.api.resthttp.processor.ExceptionProcessor;
-import org.opentosca.bus.management.api.resthttp.processor.GetResultProcessor;
-import org.opentosca.bus.management.api.resthttp.processor.GetResultRequestProcessor;
-import org.opentosca.bus.management.api.resthttp.processor.GetResultResponseProcessor;
-
-/**
- * InvocationRoute of the Management Bus REST-API.
- *
- *
- * The "getResult" endpoint of the REST-API is created here.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class GetResultRoute extends RouteBuilder {
-
- @Override
- public void configure() throws Exception {
-
- final GetResultRequestProcessor getResultRequestProcessor = new GetResultRequestProcessor();
- final GetResultResponseProcessor getResultResponseProcessor = new GetResultResponseProcessor();
- final GetResultProcessor getResultProcessor = new GetResultProcessor();
- final ExceptionProcessor exceptionProcessor = new ExceptionProcessor();
-
-
- // handle exceptions
- onException(Exception.class).handled(true).setBody(property(Exchange.EXCEPTION_CAUGHT))
- .process(exceptionProcessor);
-
- from("restlet:" + InvocationRoute.BASE_ENDPOINT + InvocationRoute.GET_RESULT_ENDPOINT
- + "?restletMethods=get").process(getResultRequestProcessor).process(getResultProcessor)
- .process(getResultResponseProcessor).removeHeaders("*");
- }
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/InvocationRoute.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/InvocationRoute.java
deleted file mode 100644
index 337367fee..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/InvocationRoute.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.route;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Predicate;
-import org.apache.camel.builder.PredicateBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.opentosca.bus.management.api.resthttp.Activator;
-import org.opentosca.bus.management.api.resthttp.model.QueueMap;
-import org.opentosca.bus.management.api.resthttp.model.RequestID;
-import org.opentosca.bus.management.api.resthttp.model.ResultMap;
-import org.opentosca.bus.management.api.resthttp.processor.ExceptionProcessor;
-import org.opentosca.bus.management.api.resthttp.processor.InvocationRequestProcessor;
-import org.opentosca.bus.management.api.resthttp.processor.InvocationResponseProcessor;
-import org.opentosca.bus.management.header.MBHeader;
-
-/**
- * InvocationRoute of the Management Bus REST-API.
- *
- *
- * The "invoke" endpoint of the REST-API is created here.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class InvocationRoute extends RouteBuilder {
-
-
- private static final String HOST = "http://localhost";
-
- private static final String PORT = "8086";
- static final String BASE_ENDPOINT = HOST + ":" + PORT;
-
- public static final String INVOKE_ENDPOINT = "/ManagementBus/v1/invoker";
-
- public static final String ID = "id";
- public static final String ID_PLACEHODLER = "{" + ID + "}";
- public static final String POLL_ENDPOINT = INVOKE_ENDPOINT + "/activeRequests/" + ID_PLACEHODLER;
- public static final String GET_RESULT_ENDPOINT = POLL_ENDPOINT + "/response";
-
- // Management Bus Endpoints
- private static final String MANAGEMENT_BUS_IA =
- "bean:org.opentosca.bus.management.service.IManagementBusService?method=invokeIA";
- private static final String MANAGEMENT_BUS_PLAN =
- "bean:org.opentosca.bus.management.service.IManagementBusService?method=invokePlan";
-
- private static final String MANAGEMENT_BUS_REQUEST_ID_HEADER = "ManagementBusRequestID";
-
-
- @Override
- public void configure() throws Exception {
-
- // Checks if invoking a IA
- final Predicate INVOKE_IA = PredicateBuilder.or(header(MBHeader.NODETEMPLATEID_STRING.toString()).isNotNull(),
- header(MBHeader.PLANID_QNAME.toString()).isNotNull());
- // Checks if invoking a Plan
- final Predicate INVOKE_PLAN = header(MBHeader.PLANID_QNAME.toString()).isNotNull();
-
-
- final InvocationRequestProcessor invocationRequestProcessor = new InvocationRequestProcessor();
- final InvocationResponseProcessor invocationResponseProcessor = new InvocationResponseProcessor();
- final ExceptionProcessor exceptionProcessor = new ExceptionProcessor();
-
- // handle exceptions
- this.onException(Exception.class).handled(true).setBody(property(Exchange.EXCEPTION_CAUGHT))
- .process(exceptionProcessor);
-
- // invoke main route
- this.from("restlet:" + BASE_ENDPOINT + INVOKE_ENDPOINT + "?restletMethods=post").doTry()
- .process(invocationRequestProcessor).doCatch(Exception.class).end().choice()
- .when(property(Exchange.EXCEPTION_CAUGHT).isNull()).to("direct:invoke").otherwise().to("direct:exception")
- .end().removeHeaders("*");
-
- // route if no exception was caught
- this.from("direct:invoke")
- .setHeader(MANAGEMENT_BUS_REQUEST_ID_HEADER, this.method(RequestID.class, "getNextID"))
- .wireTap("direct:toManagementBus").end().to("direct:init").process(invocationResponseProcessor);
-
- // route in case an exception was caught
- this.from("direct:exception").setBody(property(Exchange.EXCEPTION_CAUGHT)).process(exceptionProcessor);
-
- // set "isFinsihed"-flag to false for this request
- this.from("direct:init").bean(QueueMap.class, "notFinished(${header." + MANAGEMENT_BUS_REQUEST_ID_HEADER + "})")
- .setBody(this.simple("${header." + MANAGEMENT_BUS_REQUEST_ID_HEADER + "}"));
-
- // route to management bus engine
- this.from("direct:toManagementBus").choice().when(INVOKE_IA).to(MANAGEMENT_BUS_IA).when(INVOKE_PLAN)
- .to(MANAGEMENT_BUS_PLAN).end();
-
- // invoke response route
- this.from("direct-vm:" + Activator.apiID)
- .bean(QueueMap.class, "finished(${header." + MANAGEMENT_BUS_REQUEST_ID_HEADER + "})")
- .bean(ResultMap.class, "put(${header." + MANAGEMENT_BUS_REQUEST_ID_HEADER + "}, ${body})").stop();
-
- }
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/IsFinishedRoute.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/IsFinishedRoute.java
deleted file mode 100644
index 398702701..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/IsFinishedRoute.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.route;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.opentosca.bus.management.api.resthttp.processor.ExceptionProcessor;
-import org.opentosca.bus.management.api.resthttp.processor.IsFinishedProcessor;
-import org.opentosca.bus.management.api.resthttp.processor.IsFinishedRequestProcessor;
-import org.opentosca.bus.management.api.resthttp.processor.IsFinishedResponseProcessor;
-
-/**
- * InvocationRoute of the Management Bus REST-API.
- *
- *
- * The "isFinished" endpoint of the REST-API is created here.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class IsFinishedRoute extends RouteBuilder {
-
- @Override
- public void configure() throws Exception {
-
- final IsFinishedRequestProcessor isFinishedRequestProcessor = new IsFinishedRequestProcessor();
- final IsFinishedProcessor isFinishedProcessor = new IsFinishedProcessor();
- final IsFinishedResponseProcessor isFinishedResponseProcessor = new IsFinishedResponseProcessor();
- final ExceptionProcessor exceptionProcessor = new ExceptionProcessor();
-
- // handle exceptions
- onException(Exception.class).handled(true).setBody(property(Exchange.EXCEPTION_CAUGHT))
- .process(exceptionProcessor);
-
- from("restlet:" + InvocationRoute.BASE_ENDPOINT + InvocationRoute.POLL_ENDPOINT
- + "?restletMethods=get").process(isFinishedRequestProcessor).process(isFinishedProcessor)
- .process(isFinishedResponseProcessor).removeHeaders("*");
- }
-}
diff --git a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/OptionsRoute.java b/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/OptionsRoute.java
deleted file mode 100644
index 135b7a7ab..000000000
--- a/org.opentosca.bus.management.api.resthttp/src/org/opentosca/bus/management/api/resthttp/route/OptionsRoute.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.opentosca.bus.management.api.resthttp.route;
-
-import org.apache.camel.builder.RouteBuilder;
-
-/**
- * Route of the Management Bus REST-API to handle OPTIONS requests.
- *
- *
- * The "options" endpoint of the REST-API is created here.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@iaas.uni-stuttgart.de
- *
- */
-public class OptionsRoute extends RouteBuilder {
-
- @Override
- public void configure() throws Exception {
- // options route
- // from("restlet:" + InvocationRoute.BASE_ENDPOINT + InvocationRoute.INVOKE_ENDPOINT
- // + "?restletMethods=options");
- //
- // from("restlet:" + InvocationRoute.BASE_ENDPOINT + InvocationRoute.GET_RESULT_ENDPOINT
- // + "?restletMethods=options");
- }
-}
diff --git a/org.opentosca.bus.management.api.soaphttp/META-INF/MANIFEST.MF b/org.opentosca.bus.management.api.soaphttp/META-INF/MANIFEST.MF
deleted file mode 100644
index 0eb613026..000000000
--- a/org.opentosca.bus.management.api.soaphttp/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,27 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.opentosca.bus.management.api.soaphttp
-Bundle-SymbolicName: org.opentosca.bus.management.api.soaphttp
-Bundle-Version: 2.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: com.fasterxml.jackson.databind;version="2.6.2",
- com.google.gson;version="2.2.4",
- org.apache.camel;version="2.10.4",
- org.apache.camel.builder;version="2.10.4",
- org.apache.camel.component.cxf.common.header;version="2.18.3",
- org.apache.camel.component.cxf.common.message;version="2.10.4",
- org.apache.camel.converter.jaxb;version="2.10.4",
- org.apache.camel.core.osgi;version="2.10.4",
- org.apache.camel.impl;version="2.10.4",
- org.apache.camel.model;version="2.10.4",
- org.apache.camel.spi;version="2.10.4",
- org.apache.commons.io;version="2.2.0",
- org.apache.cxf.binding.soap;version="2.7.3",
- org.apache.cxf.headers;version="2.7.3",
- org.osgi.framework;version="1.6.0",
- org.slf4j;version="1.7.5"
-Bundle-Activator: org.opentosca.bus.management.api.soaphttp.Activator
-Service-Component: OSGI-INF/EndpointServiceHandler - component.xml
-Require-Bundle: org.opentosca.container.core;bundle-version="1.0.0",
- org.opentosca.bus.management;bundle-version="1.0.0"
-Bundle-ActivationPolicy: lazy
diff --git a/org.opentosca.bus.management.api.soaphttp/OSGI-INF/EndpointServiceHandler - component.xml b/org.opentosca.bus.management.api.soaphttp/OSGI-INF/EndpointServiceHandler - component.xml
deleted file mode 100644
index adb23756d..000000000
--- a/org.opentosca.bus.management.api.soaphttp/OSGI-INF/EndpointServiceHandler - component.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/org.opentosca.bus.management.api.soaphttp/build.properties b/org.opentosca.bus.management.api.soaphttp/build.properties
deleted file mode 100644
index c63d86e42..000000000
--- a/org.opentosca.bus.management.api.soaphttp/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = .,\
- META-INF/,\
- OSGI-INF/
diff --git a/org.opentosca.bus.management.api.soaphttp/pom.xml b/org.opentosca.bus.management.api.soaphttp/pom.xml
deleted file mode 100644
index 132667cb9..000000000
--- a/org.opentosca.bus.management.api.soaphttp/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.management.api.soaphttp
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/Activator.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/Activator.java
deleted file mode 100644
index 49b73b81d..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/Activator.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.opentosca.bus.management.api.soaphttp;
-
-import org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy;
-import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
-import org.apache.camel.core.osgi.OsgiServiceRegistry;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.opentosca.bus.management.api.soaphttp.route.Route;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Activator of the SOAP/HTTP-Management Bus-API.
- *
- *
- * Copyright 2013 IAAS University of Stuttgart
- *
- *
- * The activator is needed to add and start the camel routes.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Activator implements BundleActivator {
-
- final private static Logger LOG = LoggerFactory.getLogger(Activator.class);
-
- public static String apiID;
-
- public static BundleContext bundleContext;
-
-
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
-
- Activator.apiID = bundleContext.getBundle().getSymbolicName();
-
- // Set relayHeaders to false to drop all SOAP headers
- final CxfHeaderFilterStrategy headerStrategy = new CxfHeaderFilterStrategy();
- headerStrategy.setRelayHeaders(false);
-
- bundleContext.registerService(CxfHeaderFilterStrategy.class, headerStrategy, null);
-
- final DefaultCamelContext camelContext = new OsgiDefaultCamelContext(bundleContext);
- camelContext.addRoutes(new Route());
- camelContext.start();
-
- Activator.bundleContext = bundleContext;
- Activator.LOG.info("SI-SOAP/HTTP-Management Bus-API started!");
- }
-
- @Override
- public void stop(final BundleContext arg0) throws Exception {
-
- Activator.LOG.info("SI-SOAP/HTTP-Management Bus-API stopped!");
- }
-
-}
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/EndpointServiceHandler.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/EndpointServiceHandler.java
deleted file mode 100644
index 9e6c3279a..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/EndpointServiceHandler.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.opentosca.bus.management.api.soaphttp;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-
-import org.opentosca.bus.management.api.soaphttp.route.Route;
-import org.opentosca.container.core.common.Settings;
-import org.opentosca.container.core.model.csar.id.CSARID;
-import org.opentosca.container.core.model.endpoint.wsdl.WSDLEndpoint;
-import org.opentosca.container.core.service.ICoreEndpointService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EndpointServiceHandler {
-
- public static ICoreEndpointService endpointService, oldEndpointService;
-
- private final static Logger LOG = LoggerFactory.getLogger(EndpointServiceHandler.class);
-
-
- /**
- * Bind EndpointService.
- *
- * @param endpointService - The endpointService to register.
- */
- public void bindEndpointService(final ICoreEndpointService endpointService) {
- if (endpointService != null) {
- if (EndpointServiceHandler.endpointService == null) {
- EndpointServiceHandler.endpointService = endpointService;
- } else {
- EndpointServiceHandler.oldEndpointService = endpointService;
- EndpointServiceHandler.endpointService = endpointService;
- }
-
- EndpointServiceHandler.LOG.debug("Bind Endpoint Service: {} bound.", endpointService.toString());
-
- EndpointServiceHandler.LOG.debug("Storing the Management Bus SOAP-API endpoint: {} via EndpointService...",
- Route.PUBLIC_ENDPOINT);
-
- URI uri = null;
- try {
- uri = new URI(Route.PUBLIC_ENDPOINT);
-
- }
- catch (final URISyntaxException e) {
- e.printStackTrace();
- }
- // Stores the Management Bus endpoint in the endpointDB. "***",
- // cause the MB-endpoint is csar independent.
- final String localContainer = Settings.OPENTOSCA_CONTAINER_HOSTNAME;
- final WSDLEndpoint endpoint = new WSDLEndpoint(uri, Route.PORTTYPE, localContainer, localContainer,
- new CSARID("***"), null, null, null, null, new HashMap());
- EndpointServiceHandler.endpointService.storeWSDLEndpoint(endpoint);
-
- } else {
- EndpointServiceHandler.LOG.error("Bind Endpoint Service: Supplied parameter is null!");
- }
-
- }
-
- /**
- * Unbind EndpointService.
- *
- * @param endpointService - The endpointService to unregister.
- */
- public void unbindEndpointService(ICoreEndpointService endpointService) {
- if (EndpointServiceHandler.oldEndpointService == null) {
- endpointService = null;
- } else {
- EndpointServiceHandler.oldEndpointService = null;
- }
-
- EndpointServiceHandler.LOG.debug("Unbind Endpoint Service unbound.");
- }
-}
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/Doc.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/Doc.java
deleted file mode 100644
index c2914cf50..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/Doc.java
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, v2.2.8-b130911.1802
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2018.07.16 at 01:55:00 PM CEST
-//
-
-
-package org.opentosca.bus.management.api.soaphttp.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAnyElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.w3c.dom.Element;
-
-
-/**
- *
- * Java class for Doc complex type.
- *
- *
- * The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="Doc">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <any processContents='skip' minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Doc", propOrder = {"any"})
-public class Doc {
-
- @XmlAnyElement
- protected Element any;
-
- /**
- * Gets the value of the any property.
- *
- * @return possible object is {@link Element }
- *
- */
- public Element getAny() {
- return this.any;
- }
-
- /**
- * Sets the value of the any property.
- *
- * @param value allowed object is {@link Element }
- *
- */
- public void setAny(final Element value) {
- this.any = value;
- }
-
-}
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/ObjectFactory.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/ObjectFactory.java
deleted file mode 100644
index f4229457f..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/ObjectFactory.java
+++ /dev/null
@@ -1,147 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, v2.2.8-b130911.1802
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2018.07.16 at 01:55:00 PM CEST
-//
-
-
-package org.opentosca.bus.management.api.soaphttp.model;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlElementDecl;
-import javax.xml.bind.annotation.XmlRegistry;
-import javax.xml.namespace.QName;
-
-
-/**
- * This object contains factory methods for each Java content interface and Java element interface
- * generated in the org.opentosca.bus.management.api.soaphttp.model package.
- *
- * An ObjectFactory allows you to programatically construct new instances of the Java representation
- * for XML content. The Java representation of XML content can consist of schema derived interfaces
- * and classes representing the binding of schema type definitions, element declarations and model
- * groups. Factory methods for each of these are provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
- private final static QName _InvokeOperationAsync_QNAME =
- new QName("http://siserver.org/schema", "invokeOperationAsync");
- private final static QName _InvokePlan_QNAME = new QName("http://siserver.org/schema", "invokePlan");
- private final static QName _InvokeResponse_QNAME = new QName("http://siserver.org/schema", "invokeResponse");
- private final static QName _InvokeOperation_QNAME = new QName("http://siserver.org/schema", "invokeOperation");
- private final static QName _InvokeOperationSync_QNAME =
- new QName("http://siserver.org/schema", "invokeOperationSync");
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes
- * for package: org.opentosca.bus.management.api.soaphttp.model
- *
- */
- public ObjectFactory() {}
-
- /**
- * Create an instance of {@link InvokeOperationAsync }
- *
- */
- public InvokeOperationAsync createInvokeOperationAsync() {
- return new InvokeOperationAsync();
- }
-
- /**
- * Create an instance of {@link InvokeResponse }
- *
- */
- public InvokeResponse createInvokeResponse() {
- return new InvokeResponse();
- }
-
- /**
- * Create an instance of {@link InvokePlan }
- *
- */
- public InvokePlan createInvokePlan() {
- return new InvokePlan();
- }
-
- /**
- * Create an instance of {@link InvokeOperationSync }
- *
- */
- public InvokeOperationSync createInvokeOperationSync() {
- return new InvokeOperationSync();
- }
-
- /**
- * Create an instance of {@link ParamsMapItemType }
- *
- */
- public ParamsMapItemType createParamsMapItemType() {
- return new ParamsMapItemType();
- }
-
- /**
- * Create an instance of {@link Doc }
- *
- */
- public Doc createDoc() {
- return new Doc();
- }
-
- /**
- * Create an instance of {@link ParamsMap }
- *
- */
- public ParamsMap createParamsMap() {
- return new ParamsMap();
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link InvokeOperationAsync }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://siserver.org/schema", name = "invokeOperationAsync")
- public JAXBElement createInvokeOperationAsync(final InvokeOperationAsync value) {
- return new JAXBElement<>(_InvokeOperationAsync_QNAME, InvokeOperationAsync.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link InvokePlan }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://siserver.org/schema", name = "invokePlan")
- public JAXBElement createInvokePlan(final InvokePlan value) {
- return new JAXBElement<>(_InvokePlan_QNAME, InvokePlan.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link InvokeResponse }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://siserver.org/schema", name = "invokeResponse")
- public JAXBElement createInvokeResponse(final InvokeResponse value) {
- return new JAXBElement<>(_InvokeResponse_QNAME, InvokeResponse.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link InvokeOperationAsync }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://siserver.org/schema", name = "invokeOperation")
- public JAXBElement createInvokeOperation(final InvokeOperationAsync value) {
- return new JAXBElement<>(_InvokeOperation_QNAME, InvokeOperationAsync.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link InvokeOperationSync }{@code >}}
- *
- */
- @XmlElementDecl(namespace = "http://siserver.org/schema", name = "invokeOperationSync")
- public JAXBElement createInvokeOperationSync(final InvokeOperationSync value) {
- return new JAXBElement<>(_InvokeOperationSync_QNAME, InvokeOperationSync.class, null, value);
- }
-
-}
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/ParamsMap.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/ParamsMap.java
deleted file mode 100644
index 3407056fe..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/ParamsMap.java
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, v2.2.8-b130911.1802
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2018.07.16 at 01:55:00 PM CEST
-//
-
-
-package org.opentosca.bus.management.api.soaphttp.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- *
- * Java class for ParamsMap complex type.
- *
- *
- * The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="ParamsMap">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="Param" type="{http://siserver.org/schema}ParamsMapItemType" maxOccurs="unbounded"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ParamsMap", propOrder = {"param"})
-public class ParamsMap {
-
- @XmlElement(name = "Param", required = true)
- protected List param;
-
- /**
- * Gets the value of the param property.
- *
- *
- * This accessor method returns a reference to the live list, not a snapshot. Therefore any
- * modification you make to the returned list will be present inside the JAXB object. This is
- * why there is not a set method for the param property.
- *
- *
- * For example, to add a new item, do as follows:
- *
- *
- * getParam().add(newItem);
- *
- *
- *
- *
- * Objects of the following type(s) are allowed in the list {@link ParamsMapItemType }
- *
- *
- */
- public List getParam() {
- if (this.param == null) {
- this.param = new ArrayList<>();
- }
- return this.param;
- }
-
-}
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/ParamsMapItemType.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/ParamsMapItemType.java
deleted file mode 100644
index 75f32d80e..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/ParamsMapItemType.java
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, v2.2.8-b130911.1802
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2018.07.16 at 01:55:00 PM CEST
-//
-
-
-package org.opentosca.bus.management.api.soaphttp.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- *
- * Java class for ParamsMapItemType complex type.
- *
- *
- * The following schema fragment specifies the expected content contained within this class.
- *
- *
- * <complexType name="ParamsMapItemType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- *
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ParamsMapItemType", propOrder = {"key", "value"})
-public class ParamsMapItemType {
-
- @XmlElement(required = true)
- protected String key;
- @XmlElement(required = true)
- protected String value;
-
- /**
- * Gets the value of the key property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getKey() {
- return this.key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setKey(final String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getValue() {
- return this.value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setValue(final String value) {
- this.value = value;
- }
-
-}
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/package-info.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/package-info.java
deleted file mode 100644
index f19951e02..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/model/package-info.java
+++ /dev/null
@@ -1,11 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, v2.2.8-b130911.1802
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2018.07.16 at 01:55:00 PM CEST
-//
-
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://siserver.org/schema",
- elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
-package org.opentosca.bus.management.api.soaphttp.model;
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/package-info.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/package-info.java
deleted file mode 100644
index 715636b07..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/package-info.java
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * This package contains the activator for starting the camel context and with it the routes of the
- * Management Bus-SOAP/HTTP-API.
- *
- * Copyright 2012 IAAS University of Stuttgart
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- */
-package org.opentosca.bus.management.api.soaphttp;
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/processor/RequestProcessor.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/processor/RequestProcessor.java
deleted file mode 100644
index bcf3b4faf..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/processor/RequestProcessor.java
+++ /dev/null
@@ -1,303 +0,0 @@
-package org.opentosca.bus.management.api.soaphttp.processor;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.cxf.common.message.CxfConstants;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.cxf.binding.soap.SoapHeader;
-import org.apache.cxf.headers.Header;
-import org.opentosca.bus.management.api.soaphttp.Activator;
-import org.opentosca.bus.management.api.soaphttp.model.Doc;
-import org.opentosca.bus.management.api.soaphttp.model.InvokeOperationAsync;
-import org.opentosca.bus.management.api.soaphttp.model.InvokeOperationSync;
-import org.opentosca.bus.management.api.soaphttp.model.InvokePlan;
-import org.opentosca.bus.management.api.soaphttp.model.ParamsMap;
-import org.opentosca.bus.management.api.soaphttp.model.ParamsMapItemType;
-import org.opentosca.bus.management.header.MBHeader;
-import org.opentosca.container.core.common.Settings;
-import org.opentosca.container.core.engine.IToscaEngineService;
-import org.opentosca.container.core.engine.ResolvedArtifacts;
-import org.opentosca.container.core.engine.ResolvedArtifacts.ResolvedDeploymentArtifact;
-import org.opentosca.container.core.model.csar.id.CSARID;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import com.google.gson.Gson;
-
-/**
- * Request-Processor of the Management Bus-SOAP/HTTP-API.
- *
- *
- * Copyright 2013 IAAS University of Stuttgart
- *
- *
- * This processor processes the incoming requests of the Management Bus-SOAP/HTTP-API. It transforms
- * the incoming unmarshalled SOAP message into a from the Management Bus understandable camel
- * exchange message. The MBHeader-Enum is used here to define the headers of the exchange message.
- *
- * @see MBHeader
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class RequestProcessor implements Processor {
-
- final private static Logger LOG = LoggerFactory.getLogger(RequestProcessor.class);
-
-
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- ParamsMap paramsMap = null;
- Doc doc = null;
- String planCorrelationID = null;
- String csarIDString = null;
- String serviceInstanceID = null;
- String callbackAddress = null;
- String messageID = null;
- String interfaceName = null;
- String operationName = null;
-
- // copy SOAP headers in camel exchange object
- RequestProcessor.LOG.debug("copy SOAP headers in camel exchange object");
- @SuppressWarnings("unchecked")
- final List soapHeaders = (List) exchange.getIn().getHeader(Header.HEADER_LIST);
- Element elementx;
- if (soapHeaders != null) {
- for (final SoapHeader header : soapHeaders) {
- elementx = (Element) header.getObject();
- exchange.getIn().setHeader(elementx.getLocalName(), elementx.getTextContent());
- }
- }
-
- if (exchange.getIn().getBody() instanceof InvokeOperationAsync) {
-
- RequestProcessor.LOG.debug("Processing async operation invocation");
-
- final InvokeOperationAsync invokeIaRequest = (InvokeOperationAsync) exchange.getIn().getBody();
-
- csarIDString = invokeIaRequest.getCsarID();
-
- planCorrelationID = invokeIaRequest.getPlanCorrelationID();
- exchange.getIn().setHeader(MBHeader.PLANCORRELATIONID_STRING.toString(), planCorrelationID);
-
- serviceInstanceID = invokeIaRequest.getServiceInstanceID();
- exchange.getIn().setHeader(MBHeader.SERVICEINSTANCEID_URI.toString(), new URI(serviceInstanceID));
-
- final String nodeInstanceID = invokeIaRequest.getNodeInstanceID();
- exchange.getIn().setHeader(MBHeader.NODEINSTANCEID_STRING.toString(), nodeInstanceID);
-
- final String serviceTemplateIDNamespaceURI = invokeIaRequest.getServiceTemplateIDNamespaceURI();
- final String serviceTemplateIDLocalPart = invokeIaRequest.getServiceTemplateIDLocalPart();
-
- final QName serviceTemplateID = new QName(serviceTemplateIDNamespaceURI, serviceTemplateIDLocalPart);
-
- exchange.getIn().setHeader(MBHeader.SERVICETEMPLATEID_QNAME.toString(), serviceTemplateID);
-
- final String nodeTemplateID = invokeIaRequest.getNodeTemplateID();
- exchange.getIn().setHeader(MBHeader.NODETEMPLATEID_STRING.toString(), nodeTemplateID);
-
- final String relationshipTemplateID = invokeIaRequest.getRelationshipTemplateID();
- exchange.getIn().setHeader(MBHeader.RELATIONSHIPTEMPLATEID_STRING.toString(), relationshipTemplateID);
-
- // Support new Deployment Artifact Header
- final ServiceReference> servRef =
- Activator.bundleContext.getServiceReference(IToscaEngineService.class.getName());
- final IToscaEngineService toscaEngineService =
- (IToscaEngineService) Activator.bundleContext.getService(servRef);
-
- final List resolvedDAs = new ArrayList<>();
- if (nodeTemplateID != null) {
- final QName nodeTemplateQName = new QName(serviceTemplateIDNamespaceURI, nodeTemplateID);
- final ResolvedArtifacts resolvedArtifacts =
- toscaEngineService.getResolvedArtifactsOfNodeTemplate(new CSARID(csarIDString), nodeTemplateQName);
- resolvedDAs.addAll(resolvedArtifacts.getDeploymentArtifacts());
- }
-
- final URL serviceInstanceIDUrl = new URL(serviceInstanceID);
- final HashMap> DAs = new HashMap<>();
- for (final ResolvedDeploymentArtifact resolvedDeploymentArtifact : resolvedDAs) {
- LOG.info("DA name:" + resolvedDeploymentArtifact.getName());
- final QName DAname = resolvedDeploymentArtifact.getType();
- final HashMap DAfiles = new HashMap<>();
- DAs.put(DAname, DAfiles);
- for (final String s : resolvedDeploymentArtifact.getReferences()) {
- LOG.info("DA getReferences:" + s);
- final String url = serviceInstanceIDUrl.getProtocol() + "://" + serviceInstanceIDUrl.getHost() + ":"
- + serviceInstanceIDUrl.getPort() + "/csars/" + csarIDString + "/content/";
- final String urlWithDa = url + s;
-
- LOG.info(urlWithDa);
- DAfiles.put(FilenameUtils.getName(urlWithDa), urlWithDa);
- }
- }
- final Gson gson = new Gson();
- exchange.getIn().setHeader(MBHeader.DEPLOYMENT_ARTIFACTS_STRING.toString(), gson.toJson(DAs));
- LOG.info("serviceInstanceID:" + serviceInstanceID);
- LOG.info("OPENTOSCA_CONTAINER_HOSTNAME:" + Settings.OPENTOSCA_CONTAINER_HOSTNAME);
- LOG.info("OPENTOSCA_CONTAINER_PORT:" + Settings.OPENTOSCA_CONTAINER_PORT);
- LOG.info("serviceTemplateIDNamespaceURI:" + serviceTemplateIDNamespaceURI);
-
- interfaceName = invokeIaRequest.getInterfaceName();
-
- if (interfaceName != null && !(interfaceName.equals("?") || interfaceName.isEmpty())) {
- exchange.getIn().setHeader(MBHeader.INTERFACENAME_STRING.toString(), interfaceName);
- }
-
- operationName = invokeIaRequest.getOperationName();
-
- callbackAddress = invokeIaRequest.getReplyTo();
-
- messageID = invokeIaRequest.getMessageID();
-
- paramsMap = invokeIaRequest.getParams();
-
- doc = invokeIaRequest.getDoc();
-
- if (callbackAddress != null && !(callbackAddress.isEmpty() || callbackAddress.equals("?"))) {
- exchange.getIn().setHeader("ReplyTo", callbackAddress);
- }
-
- if (messageID != null && !(messageID.isEmpty() || messageID.equals("?"))) {
- exchange.getIn().setHeader("MessageID", messageID);
- }
-
- exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "invokeIA");
-
- }
-
- if (exchange.getIn().getBody() instanceof InvokeOperationSync) {
-
- RequestProcessor.LOG.debug("Processing sync operation invocation");
-
- final InvokeOperationSync invokeIaRequest = (InvokeOperationSync) exchange.getIn().getBody();
-
- csarIDString = invokeIaRequest.getCsarID();
-
- planCorrelationID = invokeIaRequest.getPlanCorrelationID();
- exchange.getIn().setHeader(MBHeader.PLANCORRELATIONID_STRING.toString(), planCorrelationID);
-
- serviceInstanceID = invokeIaRequest.getServiceInstanceID();
- exchange.getIn().setHeader(MBHeader.SERVICEINSTANCEID_URI.toString(), new URI(serviceInstanceID));
-
- final String nodeInstanceID = invokeIaRequest.getNodeInstanceID();
- exchange.getIn().setHeader(MBHeader.NODEINSTANCEID_STRING.toString(), nodeInstanceID);
-
- final String serviceTemplateIDNamespaceURI = invokeIaRequest.getServiceTemplateIDNamespaceURI();
- final String serviceTemplateIDLocalPart = invokeIaRequest.getServiceTemplateIDLocalPart();
-
- final QName serviceTemplateID = new QName(serviceTemplateIDNamespaceURI, serviceTemplateIDLocalPart);
-
- exchange.getIn().setHeader(MBHeader.SERVICETEMPLATEID_QNAME.toString(), serviceTemplateID);
-
- final String nodeTemplateID = invokeIaRequest.getNodeTemplateID();
- exchange.getIn().setHeader(MBHeader.NODETEMPLATEID_STRING.toString(), nodeTemplateID);
-
- final String relationshipTemplateID = invokeIaRequest.getRelationshipTemplateID();
- exchange.getIn().setHeader(MBHeader.RELATIONSHIPTEMPLATEID_STRING.toString(), relationshipTemplateID);
-
- interfaceName = invokeIaRequest.getInterfaceName();
-
- if (interfaceName != null && !(interfaceName.equals("?") || interfaceName.isEmpty())) {
- exchange.getIn().setHeader(MBHeader.INTERFACENAME_STRING.toString(), interfaceName);
- }
-
- operationName = invokeIaRequest.getOperationName();
-
- paramsMap = invokeIaRequest.getParams();
-
- doc = invokeIaRequest.getDoc();
-
- exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "invokeIA");
-
- }
-
- if (exchange.getIn().getBody() instanceof InvokePlan) {
-
- RequestProcessor.LOG.debug("Processing plan invocation");
-
- final InvokePlan invokePlanRequest = (InvokePlan) exchange.getIn().getBody();
-
- csarIDString = invokePlanRequest.getCsarID();
-
- serviceInstanceID = invokePlanRequest.getServiceInstanceID();
- if (serviceInstanceID != null) {
- exchange.getIn().setHeader(MBHeader.SERVICEINSTANCEID_URI.toString(), new URI(serviceInstanceID));
- }
-
- final String planIDNamespaceURI = invokePlanRequest.getPlanIDNamespaceURI();
- final String planIDLocalPart = invokePlanRequest.getPlanIDLocalPart();
-
- final QName planID = new QName(planIDNamespaceURI, planIDLocalPart);
- exchange.getIn().setHeader(MBHeader.PLANID_QNAME.toString(), planID);
-
- operationName = invokePlanRequest.getOperationName();
-
- callbackAddress = invokePlanRequest.getReplyTo();
-
- messageID = invokePlanRequest.getMessageID();
-
- paramsMap = invokePlanRequest.getParams();
-
- doc = invokePlanRequest.getDoc();
-
- if (callbackAddress != null && !(callbackAddress.isEmpty() || callbackAddress.equals("?"))) {
- exchange.getIn().setHeader("ReplyTo", callbackAddress);
- }
-
- if (messageID != null && !(messageID.isEmpty() || messageID.equals("?"))) {
- exchange.getIn().setHeader("MessageID", messageID);
- }
-
- exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "invokePlan");
- }
-
- final CSARID csarID = new CSARID(csarIDString);
-
- exchange.getIn().setHeader(MBHeader.CSARID.toString(), csarID);
- exchange.getIn().setHeader(MBHeader.OPERATIONNAME_STRING.toString(), operationName);
- exchange.getIn().setHeader(MBHeader.APIID_STRING.toString(), Activator.apiID);
-
- if (paramsMap != null) {
- // put key-value params into camel exchange body as hashmap
- final HashMap params = new HashMap<>();
-
- for (final ParamsMapItemType param : paramsMap.getParam()) {
- params.put(param.getKey(), param.getValue());
- }
- exchange.getIn().setBody(params);
-
- }
-
- else if (doc != null && doc.getAny() != null) {
- final DocumentBuilderFactory dFact = DocumentBuilderFactory.newInstance();
- final DocumentBuilder build = dFact.newDocumentBuilder();
- final Document document = build.newDocument();
-
- final Element element = doc.getAny();
-
- document.adoptNode(element);
- document.appendChild(element);
-
- exchange.getIn().setBody(document);
-
- } else {
- exchange.getIn().setBody(null);
- }
-
- }
-}
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/processor/ResponseProcessor.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/processor/ResponseProcessor.java
deleted file mode 100644
index f35f045ea..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/processor/ResponseProcessor.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.opentosca.bus.management.api.soaphttp.processor;
-
-import java.util.HashMap;
-import java.util.Map.Entry;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.opentosca.bus.management.api.soaphttp.model.Doc;
-import org.opentosca.bus.management.api.soaphttp.model.InvokeResponse;
-import org.opentosca.bus.management.api.soaphttp.model.ParamsMap;
-import org.opentosca.bus.management.api.soaphttp.model.ParamsMapItemType;
-import org.opentosca.bus.management.header.MBHeader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * Response-Processor of the Management Bus-SOAP/HTTP-API.
- *
- *
- * Copyright 2013 IAAS University of Stuttgart
- *
- *
- * This processor processes the from the Management Bus incoming response of a invoked service. The
- * response is transformed into a marshallable object.
- *
- * @see MBHeader
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class ResponseProcessor implements Processor {
-
-
- final private static Logger LOG = LoggerFactory.getLogger(ResponseProcessor.class);
-
-
- @SuppressWarnings("unchecked")
- @Override
- public void process(final Exchange exchange) throws Exception {
-
- ResponseProcessor.LOG.debug("Processing the response...");
-
- final InvokeResponse invokeResponse = new InvokeResponse();
-
- if (exchange.getIn().getBody() instanceof HashMap) {
-
- ResponseProcessor.LOG.debug("Response is of type HashMap.");
-
- final HashMap responseMap = exchange.getIn().getBody(HashMap.class);
-
- ParamsMapItemType mapItem;
- final ParamsMap paramsMap = new ParamsMap();
-
- for (final Entry entry : responseMap.entrySet()) {
- final String key = entry.getKey();
- final String value = entry.getValue();
- mapItem = new ParamsMapItemType();
- mapItem.setKey(key);
- mapItem.setValue(value);
- paramsMap.getParam().add(mapItem);
- }
-
- invokeResponse.setParams(paramsMap);
-
- exchange.getIn().setBody(invokeResponse);
-
- }
-
- if (exchange.getIn().getBody() instanceof Document) {
-
- ResponseProcessor.LOG.debug("Response is of type Document.");
-
- final Document responseDoc = exchange.getIn().getBody(Document.class);
- final NodeList nodeList = responseDoc.getChildNodes();
-
- final Doc ar = new Doc();
-
- for (int i = 0; i < nodeList.getLength(); i++) {
- ar.setAny((Element) nodeList.item(i));
-
- }
- invokeResponse.setDoc(ar);
- exchange.getIn().setBody(invokeResponse);
-
- }
-
- // Async
- if (exchange.getIn().getHeader("MessageID") != null) {
-
- final String messageID = exchange.getIn().getHeader("MessageID", String.class);
-
- exchange.getIn().setHeader("operationName", "callback");
- exchange.getIn().setHeader("operationNamespace", "http://siserver.org/wsdl");
-
- exchange.getIn().setHeader("RelatesTo", messageID);
- invokeResponse.setMessageID(messageID);
-
- }
-
- }
-
-}
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/processor/package-info.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/processor/package-info.java
deleted file mode 100644
index 34e2b3ce8..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/processor/package-info.java
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * This package contains the two camel processors of the Management Bus-SOAP/HTTP-API. One for
- * processing the request and one for processing the response.
- *
- * Copyright 2012 IAAS University of Stuttgart
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- */
-package org.opentosca.bus.management.api.soaphttp.processor;
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/route/Route.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/route/Route.java
deleted file mode 100644
index a90c7f26a..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/route/Route.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.opentosca.bus.management.api.soaphttp.route;
-
-import java.net.URL;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.namespace.QName;
-
-import org.apache.camel.Predicate;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.PredicateBuilder;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy;
-import org.apache.camel.component.cxf.common.message.CxfConstants;
-import org.apache.camel.converter.jaxb.JaxbDataFormat;
-import org.opentosca.bus.management.api.soaphttp.Activator;
-import org.opentosca.bus.management.api.soaphttp.processor.RequestProcessor;
-import org.opentosca.bus.management.api.soaphttp.processor.ResponseProcessor;
-import org.opentosca.container.core.common.Settings;
-
-/**
- * Route of the Management Bus-SOAP/HTTP-API.
- *
- *
- * Copyright 2013 IAAS University of Stuttgart
- *
- *
- * Here the route an incoming invoke-request has to pass is defined. Also the web services to
- * consume and produce a SOAP message are created here. An incoming SOAP message will be
- * unmarshalled and with the request-processor transformed. After that the message will be given the
- * Management Bus for further execution. The response will be transformed, marshalled and send to
- * the recipient. Supported are both synchronous request-response communication and asynchronous
- * communication with callback. MessageID and ReplyTo-address can be passed as parameter of the SOAP
- * body or as WS-A header.
- *
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Route extends RouteBuilder {
-
-
- public final static String PUBLIC_ENDPOINT = "http://" + Settings.OPENTOSCA_CONTAINER_HOSTNAME + ":8081/invoker";
- private final static String ENDPOINT = "http://0.0.0.0:8081/invoker";
- public final static QName PORT = new QName("http://siserver.org/wsdl", "InvokePort");
- public final static QName PORTTYPE = new QName("http://siserver.org/wsdl", "InvokePortType");
-
-
- @Override
- public void configure() throws Exception {
-
- final URL wsdlURL = this.getClass().getClassLoader().getResource("META-INF/wsdl/invoker.wsdl");
-
- // CXF Endpoints
- final String INVOKE_ENDPOINT = "cxf:" + ENDPOINT + "?wsdlURL=" + wsdlURL.toString()
- + "&serviceName={http://siserver.org/wsdl}InvokerService&portName=" + Route.PORT.toString()
- + "&dataFormat=PAYLOAD&loggingFeatureEnabled=true";
- final String CALLBACK_ENDPOINT = "cxf:${header[ReplyTo]}?wsdlURL=" + wsdlURL.toString()
- + "&serviceName={http://siserver.org/wsdl}CallbackService&portName={http://siserver.org/wsdl}CallbackPort&dataFormat=PAYLOAD&loggingFeatureEnabled=true&headerFilterStrategy=#"
- + CxfHeaderFilterStrategy.class.getName();
-
- // Management Bus Endpoints
- final String MANAGEMENT_BUS_IA =
- "bean:org.opentosca.bus.management.service.IManagementBusService?method=invokeIA";
- final String MANAGEMENT_BUS_PLAN =
- "bean:org.opentosca.bus.management.service.IManagementBusService?method=invokePlan";
-
- // Checks if invoking a IA
- final Predicate INVOKE_IA = header(CxfConstants.OPERATION_NAME).isEqualTo("invokeIA");
-
- // Checks if invoking a Plan
- final Predicate INVOKE_PLAN = header(CxfConstants.OPERATION_NAME).isEqualTo("invokePlan");
-
- // Checks if invoke is sync or async
- final Predicate MESSAGEID = header("MessageID").isNotNull();
- final Predicate REPLYTO = header("ReplyTo").isNotNull();
- final Predicate ASYNC = PredicateBuilder.and(MESSAGEID, REPLYTO);
-
- final ClassLoader cl = org.opentosca.bus.management.api.soaphttp.model.ObjectFactory.class.getClassLoader();
- final JAXBContext jc = JAXBContext.newInstance("org.opentosca.bus.management.api.soaphttp.model", cl);
- final JaxbDataFormat requestJaxb = new JaxbDataFormat(jc);
- final JaxbDataFormat responseJaxb = new JaxbDataFormat(jc);
- responseJaxb.setPartClass("org.opentosca.bus.management.api.soaphttp.model.InvokeResponse");
- responseJaxb.setPartNamespace(new QName("http://siserver.org/schema", "invokeResponse"));
-
- final Processor requestProcessor = new RequestProcessor();
- final Processor responseProcessor = new ResponseProcessor();
-
- this.from(INVOKE_ENDPOINT).unmarshal(requestJaxb).process(requestProcessor).choice().when(INVOKE_IA)
- .to(MANAGEMENT_BUS_IA).when(INVOKE_PLAN).to(MANAGEMENT_BUS_PLAN).end();
-
- this.from("direct-vm:" + Activator.apiID).process(responseProcessor).marshal(responseJaxb).choice().when(ASYNC)
- .recipientList(this.simple(CALLBACK_ENDPOINT)).end();
- }
-}
diff --git a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/route/package-info.java b/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/route/package-info.java
deleted file mode 100644
index a3e58c3c5..000000000
--- a/org.opentosca.bus.management.api.soaphttp/src/org/opentosca/bus/management/api/soaphttp/route/package-info.java
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * This package contains the camel routes of the Management Bus-SOAP/HTTP-API.
- *
- * Copyright 2012 IAAS University of Stuttgart
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- */
-package org.opentosca.bus.management.api.soaphttp.route;
diff --git a/org.opentosca.bus.management.deployment.plugin.remote/META-INF/MANIFEST.MF b/org.opentosca.bus.management.deployment.plugin.remote/META-INF/MANIFEST.MF
deleted file mode 100644
index 76552c1ad..000000000
--- a/org.opentosca.bus.management.deployment.plugin.remote/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,18 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.opentosca.bus.management.deployment.plugin.remote
-Bundle-SymbolicName: org.opentosca.bus.management.deployment.plugin.remote
-Bundle-Version: 2.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.apache.camel;version="2.10.4",
- org.apache.camel.impl;version="2.10.4",
- org.osgi.framework;version="1.8.0",
- org.slf4j;version="1.6.4"
-Service-Component: OSGI-INF/*
-Require-Bundle: org.opentosca.container.core.tosca;bundle-version="1.0.0",
- org.opentosca.bus.management.deployment.plugin;bundle-version="1.0.0",
- org.opentosca.bus.management;bundle-version="1.0.0",
- org.opentosca.container.core,
- org.opentosca.bus.management.service.impl
-Bundle-ActivationPolicy: lazy
-Bundle-Activator: org.opentosca.bus.management.deployment.plugin.remote.Activator
diff --git a/org.opentosca.bus.management.deployment.plugin.remote/OSGI-INF/ManagementBusDeploymentPluginRemote - component.xml b/org.opentosca.bus.management.deployment.plugin.remote/OSGI-INF/ManagementBusDeploymentPluginRemote - component.xml
deleted file mode 100644
index eea9d9276..000000000
--- a/org.opentosca.bus.management.deployment.plugin.remote/OSGI-INF/ManagementBusDeploymentPluginRemote - component.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/org.opentosca.bus.management.deployment.plugin.remote/build.properties b/org.opentosca.bus.management.deployment.plugin.remote/build.properties
deleted file mode 100644
index d6642e652..000000000
--- a/org.opentosca.bus.management.deployment.plugin.remote/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
diff --git a/org.opentosca.bus.management.deployment.plugin.remote/pom.xml b/org.opentosca.bus.management.deployment.plugin.remote/pom.xml
deleted file mode 100644
index fd9935ec4..000000000
--- a/org.opentosca.bus.management.deployment.plugin.remote/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.management.deployment.plugin.remote
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.deployment.plugin.remote/src/org/opentosca/bus/management/deployment/plugin/remote/Activator.java b/org.opentosca.bus.management.deployment.plugin.remote/src/org/opentosca/bus/management/deployment/plugin/remote/Activator.java
deleted file mode 100644
index d42d1de54..000000000
--- a/org.opentosca.bus.management.deployment.plugin.remote/src/org/opentosca/bus/management/deployment/plugin/remote/Activator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright 2012 - 2018, University of Stuttgart and the OpenTOSCA contributors
- * SPDX-License-Identifier: Apache-2.0
- *******************************************************************************/
-package org.opentosca.bus.management.deployment.plugin.remote;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Activator implements BundleActivator {
-
- private static Logger logger = LoggerFactory.getLogger(Activator.class);
-
- private static BundleContext context;
-
-
- static BundleContext getContext() {
- return context;
- }
-
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
- logger.info("Starting bundle \"{}\" ({})...", bundleContext.getBundle().getSymbolicName(),
- bundleContext.getBundle().getVersion());
- context = bundleContext;
- }
-
- @Override
- public void stop(final BundleContext bundleContext) throws Exception {
- logger.info("Stopping bundle \"{}\" ({})...", bundleContext.getBundle().getSymbolicName(),
- bundleContext.getBundle().getVersion());
- Activator.context = null;
- }
-}
diff --git a/org.opentosca.bus.management.deployment.plugin.script/META-INF/MANIFEST.MF b/org.opentosca.bus.management.deployment.plugin.script/META-INF/MANIFEST.MF
deleted file mode 100644
index 7a5974afd..000000000
--- a/org.opentosca.bus.management.deployment.plugin.script/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,17 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.opentosca.bus.management.deployment.plugin.script
-Bundle-SymbolicName: org.opentosca.bus.management.deployment.plugin.script
-Bundle-Version: 2.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.apache.camel;version="2.18.3",
- org.apache.cxf.message;version="3.1.10",
- org.eclipse.osgi.util;version="1.1.0",
- org.osgi.framework;version="1.8.0",
- org.slf4j;version="1.6.4"
-Service-Component: OSGI-INF/*
-Require-Bundle: org.opentosca.container.core.tosca;bundle-version="1.0.0",
- org.opentosca.bus.management.deployment.plugin;bundle-version="1.0.0",
- org.opentosca.bus.management;bundle-version="1.0.0"
-Bundle-ActivationPolicy: lazy
-Bundle-Activator: org.opentosca.bus.management.deployment.plugin.script.Activator
diff --git a/org.opentosca.bus.management.deployment.plugin.script/OSGI-INF/ManagementBusDeploymentPluginScript - component.xml b/org.opentosca.bus.management.deployment.plugin.script/OSGI-INF/ManagementBusDeploymentPluginScript - component.xml
deleted file mode 100644
index d7b38333c..000000000
--- a/org.opentosca.bus.management.deployment.plugin.script/OSGI-INF/ManagementBusDeploymentPluginScript - component.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/org.opentosca.bus.management.deployment.plugin.script/build.properties b/org.opentosca.bus.management.deployment.plugin.script/build.properties
deleted file mode 100644
index d6642e652..000000000
--- a/org.opentosca.bus.management.deployment.plugin.script/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
diff --git a/org.opentosca.bus.management.deployment.plugin.script/pom.xml b/org.opentosca.bus.management.deployment.plugin.script/pom.xml
deleted file mode 100644
index 9a3b92c43..000000000
--- a/org.opentosca.bus.management.deployment.plugin.script/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.management.deployment.plugin.script
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/Activator.java b/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/Activator.java
deleted file mode 100644
index b1a0196d1..000000000
--- a/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/Activator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright 2012 - 2018, University of Stuttgart and the OpenTOSCA contributors
- * SPDX-License-Identifier: Apache-2.0
- *******************************************************************************/
-package org.opentosca.bus.management.deployment.plugin.script;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Activator implements BundleActivator {
-
- private static Logger logger = LoggerFactory.getLogger(Activator.class);
-
- private static BundleContext context;
-
-
- static BundleContext getContext() {
- return context;
- }
-
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
- logger.info("Starting bundle \"{}\" ({})...", bundleContext.getBundle().getSymbolicName(),
- bundleContext.getBundle().getVersion());
- context = bundleContext;
- }
-
- @Override
- public void stop(final BundleContext bundleContext) throws Exception {
- logger.info("Stopping bundle \"{}\" ({})...", bundleContext.getBundle().getSymbolicName(),
- bundleContext.getBundle().getVersion());
- Activator.context = null;
- }
-}
diff --git a/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/ManagementBusDeploymentPluginScript.java b/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/ManagementBusDeploymentPluginScript.java
deleted file mode 100644
index aa5e69a95..000000000
--- a/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/ManagementBusDeploymentPluginScript.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.opentosca.bus.management.deployment.plugin.script;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.opentosca.bus.management.deployment.plugin.IManagementBusDeploymentPluginService;
-import org.opentosca.bus.management.deployment.plugin.script.util.Messages;
-import org.opentosca.bus.management.header.MBHeader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Management Bus-Plug-in for the deployment of Script IAs.
- *
- *
- *
- *
- * Since Script IAs have to be executed on a host machine, they don´t have to be deployed.
- * Therefore, this Plug-in is only a wrapper for the supported types and capabilities. When the
- * deployment is invoked it just returns a wildcard endpoint. Likewise, it always returns success
- * when the undeployment is invoked.
- *
- *
- *
- * @author Benjamin Weder - st100495@stud.uni-stuttgart.de
- *
- *
- */
-public class ManagementBusDeploymentPluginScript implements IManagementBusDeploymentPluginService {
-
- // In messages.properties defined plugin types and capabilities
- static final private String TYPES = Messages.DeploymentPluginScript_types;
- static final private String CAPABILITIES = Messages.DeploymentPluginScript_capabilities;
-
- static final private Logger LOG = LoggerFactory.getLogger(ManagementBusDeploymentPluginScript.class);
-
- @Override
- public Exchange invokeImplementationArtifactDeployment(final Exchange exchange) {
- URI endpoint = null;
- try {
- // return dummy endpoint for further processing without aborting due to missing endpoint
- endpoint = new URI("ManagementBusDeploymentPluginScript:ScriptEndpoint");
- }
- catch (final URISyntaxException e) {
- e.printStackTrace();
- }
- exchange.getIn().setHeader(MBHeader.ENDPOINT_URI.toString(), endpoint);
- return exchange;
- }
-
- @Override
- public Exchange invokeImplementationArtifactUndeployment(final Exchange exchange) {
- exchange.getIn().setHeader(MBHeader.OPERATIONSTATE_BOOLEAN.toString(), true);
- return exchange;
- }
-
- @Override
- /**
- * {@inheritDoc}
- */
- public List getSupportedTypes() {
- ManagementBusDeploymentPluginScript.LOG.debug("Getting Types: {}.", ManagementBusDeploymentPluginScript.TYPES);
- final List types = new ArrayList<>();
-
- for (final String type : ManagementBusDeploymentPluginScript.TYPES.split("[,;]")) {
- types.add(type.trim());
- }
- return types;
- }
-
- @Override
- /**
- * {@inheritDoc}
- */
- public List getCapabilties() {
- ManagementBusDeploymentPluginScript.LOG.debug("Getting Plugin-Capabilities: {}.",
- ManagementBusDeploymentPluginScript.CAPABILITIES);
- final List capabilities = new ArrayList<>();
-
- for (final String capability : ManagementBusDeploymentPluginScript.CAPABILITIES.split("[,;]")) {
- capabilities.add(capability.trim());
- }
- return capabilities;
- }
-}
diff --git a/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/util/Messages.java b/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/util/Messages.java
deleted file mode 100644
index 7d7ffaba1..000000000
--- a/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/util/Messages.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.opentosca.bus.management.deployment.plugin.script.util;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Utility class to define Strings in messages.properties.
- */
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
- public static String DeploymentPluginScript_types;
- public static String DeploymentPluginScript_capabilities;
- static {
- // initialize resource bundle
- NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {}
-}
diff --git a/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/util/messages.properties b/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/util/messages.properties
deleted file mode 100644
index 8e00c9f64..000000000
--- a/org.opentosca.bus.management.deployment.plugin.script/src/org/opentosca/bus/management/deployment/plugin/script/util/messages.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-# Contains the type of the plugin as well as provided capabilities.
-DeploymentPluginScript_types={http://opentosca.org/artifacttypes}Chef, {http://opentosca.org/artifacttypes}Ansible, {http://www.example.com/clartigr/tosca}clartigr, {http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes}Chef, {http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes}Puppet, {http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes}Juju, {http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes}CloudFoundry, {http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes}UnixShell, {http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes}ScriptArtifact
-DeploymentPluginScript_capabilities=
\ No newline at end of file
diff --git a/org.opentosca.bus.management.deployment.plugin.tomcat/META-INF/MANIFEST.MF b/org.opentosca.bus.management.deployment.plugin.tomcat/META-INF/MANIFEST.MF
deleted file mode 100644
index 66bea68d8..000000000
--- a/org.opentosca.bus.management.deployment.plugin.tomcat/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,24 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.opentosca.bus.management.deployment.plugin.tomcat
-Bundle-SymbolicName: org.opentosca.bus.management.deployment.plugin.tomcat
-Bundle-Version: 2.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.apache.camel;version="2.18.3",
- org.apache.commons.io;version="2.2.0",
- org.apache.commons.lang3;version="3.1.0",
- org.apache.cxf.message;version="3.1.10",
- org.apache.http;version="4.3.3",
- org.apache.http.client;version="4.5.2",
- org.apache.http.entity.mime;version="4.5.2",
- org.apache.http.entity.mime.content;version="4.5.2",
- org.eclipse.osgi.util;version="1.1.0",
- org.osgi.framework;version="1.8.0",
- org.slf4j;version="1.6.4"
-Service-Component: OSGI-INF/*
-Require-Bundle: org.opentosca.container.core.tosca;bundle-version="1.0.0",
- org.opentosca.bus.management.deployment.plugin;bundle-version="1.0.0",
- org.opentosca.bus.management;bundle-version="1.0.0",
- org.opentosca.container.core
-Bundle-ActivationPolicy: lazy
-Bundle-Activator: org.opentosca.bus.management.deployment.plugin.tomcat.Activator
diff --git a/org.opentosca.bus.management.deployment.plugin.tomcat/OSGI-INF/ManagementBusDeploymentPluginTomcat - component.xml b/org.opentosca.bus.management.deployment.plugin.tomcat/OSGI-INF/ManagementBusDeploymentPluginTomcat - component.xml
deleted file mode 100644
index cfdab209f..000000000
--- a/org.opentosca.bus.management.deployment.plugin.tomcat/OSGI-INF/ManagementBusDeploymentPluginTomcat - component.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/org.opentosca.bus.management.deployment.plugin.tomcat/build.properties b/org.opentosca.bus.management.deployment.plugin.tomcat/build.properties
deleted file mode 100644
index d6642e652..000000000
--- a/org.opentosca.bus.management.deployment.plugin.tomcat/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
diff --git a/org.opentosca.bus.management.deployment.plugin.tomcat/pom.xml b/org.opentosca.bus.management.deployment.plugin.tomcat/pom.xml
deleted file mode 100644
index b37469207..000000000
--- a/org.opentosca.bus.management.deployment.plugin.tomcat/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.management.deployment.plugin.tomcat
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/Activator.java b/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/Activator.java
deleted file mode 100644
index 6ec043de1..000000000
--- a/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/Activator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright 2012 - 2018, University of Stuttgart and the OpenTOSCA contributors
- * SPDX-License-Identifier: Apache-2.0
- *******************************************************************************/
-package org.opentosca.bus.management.deployment.plugin.tomcat;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Activator implements BundleActivator {
-
- private static Logger logger = LoggerFactory.getLogger(Activator.class);
-
- private static BundleContext context;
-
-
- static BundleContext getContext() {
- return context;
- }
-
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
- logger.info("Starting bundle \"{}\" ({})...", bundleContext.getBundle().getSymbolicName(),
- bundleContext.getBundle().getVersion());
- context = bundleContext;
- }
-
- @Override
- public void stop(final BundleContext bundleContext) throws Exception {
- logger.info("Stopping bundle \"{}\" ({})...", bundleContext.getBundle().getSymbolicName(),
- bundleContext.getBundle().getVersion());
- Activator.context = null;
- }
-}
diff --git a/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/ManagementBusDeploymentPluginTomcat.java b/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/ManagementBusDeploymentPluginTomcat.java
deleted file mode 100644
index 6644190ed..000000000
--- a/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/ManagementBusDeploymentPluginTomcat.java
+++ /dev/null
@@ -1,486 +0,0 @@
-package org.opentosca.bus.management.deployment.plugin.tomcat;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.entity.mime.HttpMultipartMode;
-import org.apache.http.entity.mime.MultipartEntityBuilder;
-import org.apache.http.entity.mime.content.FileBody;
-import org.opentosca.bus.management.deployment.plugin.IManagementBusDeploymentPluginService;
-import org.opentosca.bus.management.deployment.plugin.tomcat.util.Messages;
-import org.opentosca.bus.management.header.MBHeader;
-import org.opentosca.container.core.common.Settings;
-import org.opentosca.container.core.service.IHTTPService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Management Bus-Plug-in for the deployment of WAR IAs on an Apache Tomcat web server.
- *
- *
- *
- *
- * This Plug-in is able to deploy and undeploy WAR Artifacts on an Apache Tomcat. It gets a camel
- * exchange object from the Management Bus which contains all information that is needed for the
- * deployment/undeployment.
- *
- *
- * Tomcat config: Tomcat location, username and password for this Plug-in are defined in the
- * class {@link Settings} or the corresponding config.ini file.
- *
- *
- * Deployment: The {@link MBHeader#ARTIFACTREFERENCES_LIST_STRING} header field contains a
- * list with all ArtifactReferences for the current IA. This list is used to find the reference to
- * the WAR-File that has to be deployed. When a reference is found, the respective file ist
- * retrieved. The {@link MBHeader#ARTIFACTSERVICEENDPOINT_STRING} header field determines whether
- * the deployment is done on the management infrastructure or as part of the topology to which this
- * IA belongs. If the header contains a placeholder the IA is deployed as part of the topology and
- * this Plug-in just returns an endpoint. Otherwise the deployment is done via a HTTP request to the
- * Apache Tomcat.
- *
- *
- * Undeployment: The {@link MBHeader#ENDPOINT_URI} header field contains the endpoint of the
- * deployed IA. This endpoint is used to calculate the deployment path of the IA and to send an
- * undeployment request to the Tomcat.
- *
- *
- * Copyright 2018 IAAS University of Stuttgart
- *
- *
- *
- *
- * @author Benjamin Weder - st100495@stud.uni-stuttgart.de
- *
- */
-public class ManagementBusDeploymentPluginTomcat implements IManagementBusDeploymentPluginService {
-
- // In messages.properties defined plugin types and capabilities
- static final private String TYPES = Messages.DeploymentPluginTomcat_types;
- static final private String CAPABILITIES = Messages.DeploymentPluginTomcat_capabilities;
-
- private IHTTPService httpService;
-
- static final private Logger LOG = LoggerFactory.getLogger(ManagementBusDeploymentPluginTomcat.class);
-
- @Override
- public Exchange invokeImplementationArtifactDeployment(final Exchange exchange) {
-
- ManagementBusDeploymentPluginTomcat.LOG.debug("Trying to deploy IA on Tomcat.");
- final Message message = exchange.getIn();
-
- String endpoint = null;
-
- @SuppressWarnings("unchecked")
- final List artifactReferences =
- message.getHeader(MBHeader.ARTIFACTREFERENCES_LISTSTRING.toString(), List.class);
-
- // get URL of the WAR-File that has to be deployed
- final URL warURL = getWARFileReference(artifactReferences);
-
- if (warURL != null) {
- // get the WAR artifact as file
- final File warFile = getWarFile(warURL);
-
- if (warFile != null) {
- // get file name of the WAR-File
- final String fileName = FilenameUtils.getBaseName(warURL.getPath());
-
- // retrieve ServiceEndpoint property from exchange headers
- String endpointSuffix =
- message.getHeader(MBHeader.ARTIFACTSERVICEENDPOINT_STRING.toString(), String.class);
-
- if (endpointSuffix != null) {
- ManagementBusDeploymentPluginTomcat.LOG.info("Endpoint suffix from header: {}", endpointSuffix);
- } else {
- ManagementBusDeploymentPluginTomcat.LOG.info("No endpoint suffix defined.");
- endpointSuffix = "";
- }
-
- // if placeholder is defined the deployment is done in the topology
- final String placeholderBegin = "/PLACEHOLDER_";
- final String placeholderEnd = "_PLACEHOLDER/";
- if (endpointSuffix.toString().contains(placeholderBegin)
- && endpointSuffix.toString().contains(placeholderEnd)) {
-
- // just return a created endpoint and do not perform deployment
- final String placeholder =
- endpointSuffix.substring(endpointSuffix.indexOf(placeholderBegin),
- endpointSuffix.indexOf(placeholderEnd) + placeholderEnd.length());
-
- ManagementBusDeploymentPluginTomcat.LOG.info("Placeholder defined: {}. Deployment is done as part of the topology and not on the management infrastructure. ",
- placeholder);
-
- final String endpointBegin = endpointSuffix.substring(0, endpointSuffix.indexOf(placeholderBegin));
- final String endpointEnd =
- endpointSuffix.substring(endpointSuffix.lastIndexOf(placeholderEnd) + placeholderEnd.length());
-
- // We assume that the WAR-File in the topology is deployed at the default port
- // 8080 and only with the file name as path. Find a better solution which looks
- // into the topology and determines the correct endpoint.
- endpoint = endpointBegin + placeholder + ":8080/" + fileName + "/" + endpointEnd;
- } else {
-
- // check if Tomcat is running to continue deployment
- if (isRunning()) {
- ManagementBusDeploymentPluginTomcat.LOG.info("Tomcat is running and can be accessed.");
-
- final QName typeImplementation =
- message.getHeader(MBHeader.TYPEIMPLEMENTATIONID_QNAME.toString(), QName.class);
-
- final String triggeringContainer =
- message.getHeader(MBHeader.TRIGGERINGCONTAINER_STRING.toString(), String.class);
-
- // perform deployment on management infrastructure
- endpoint = deployWAROnTomcat(warFile, triggeringContainer, typeImplementation, fileName);
-
- if (endpoint != null) {
- // add endpoint suffix to endpoint of deployed WAR
- endpoint = endpoint.concat(endpointSuffix);
- ManagementBusDeploymentPluginTomcat.LOG.info("Complete endpoint of IA {}: {}", fileName,
- endpoint);
- }
- } else {
- ManagementBusDeploymentPluginTomcat.LOG.error("Deployment failed: Tomcat is not running or can´t be accessed");
- }
- }
-
- // delete the temporary file
- warFile.delete();
- } else {
- ManagementBusDeploymentPluginTomcat.LOG.error("Deployment failed: unable to retrieve WAR-File from URL");
- }
- } else {
- ManagementBusDeploymentPluginTomcat.LOG.error("Deployment failed: no referenced WAR-File found");
- }
-
- // set endpoint and pass camel exchange back to caller
- message.setHeader(MBHeader.ENDPOINT_URI.toString(), getURI(endpoint));
- return exchange;
- }
-
- @Override
- public Exchange invokeImplementationArtifactUndeployment(final Exchange exchange) {
-
- ManagementBusDeploymentPluginTomcat.LOG.debug("Trying to undeploy IA from Tomcat.");
- final Message message = exchange.getIn();
-
- // set operation state to false and only change after successful undeployment
- message.setHeader(MBHeader.OPERATIONSTATE_BOOLEAN.toString(), false);
-
- // get endpoint from header to calculate deployment path
- final URI endpointURI = message.getHeader(MBHeader.ENDPOINT_URI.toString(), URI.class);
-
- if (endpointURI != null) {
- final String endpoint = endpointURI.toString();
- ManagementBusDeploymentPluginTomcat.LOG.debug("Endpoint for undeployment: {}", endpoint);
-
- // delete Tomcat URL prefix from endpoint
- String deployPath = endpoint.replace(Settings.ENGINE_IA_TOMCAT_URL, "");
-
- // delete ServiceEndpoint suffix from endpoints
- deployPath = deployPath.substring(0, StringUtils.ordinalIndexOf(deployPath, "/", 4));
-
- // command to perform deployment on Tomcat from local file
- final String undeploymentURL = Settings.ENGINE_IA_TOMCAT_URL + "/manager/text/undeploy?path=" + deployPath;
- ManagementBusDeploymentPluginTomcat.LOG.debug("Undeployment command: {}", undeploymentURL);
-
- try {
- // perform undeployment request on Tomcat
- final HttpResponse httpResponse =
- this.httpService.Get(undeploymentURL, Settings.ENGINE_IA_TOMCAT_USERNAME,
- Settings.ENGINE_IA_TOMCAT_PASSWORD);
- final String response = IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8");
-
- ManagementBusDeploymentPluginTomcat.LOG.debug("Tomcat response: {}", response);
-
- // check if WAR-File was undeployed successfully
- if (response.contains("OK - Undeployed application at context path [" + deployPath + "]")) {
-
- ManagementBusDeploymentPluginTomcat.LOG.debug("IA successfully undeployed from Tomcat!");
- message.setHeader(MBHeader.OPERATIONSTATE_BOOLEAN.toString(), true);
-
- } else {
- ManagementBusDeploymentPluginTomcat.LOG.error("Undeployment not successfully!");
- }
- }
- catch (final IOException e) {
- ManagementBusDeploymentPluginTomcat.LOG.error("IOException occured while undeploying the WAR-File: {}!",
- e);
- }
- } else {
- ManagementBusDeploymentPluginTomcat.LOG.error("No endpoint defined. Undeployment not possible!");
- }
-
- return exchange;
- }
-
- @Override
- /**
- * {@inheritDoc}
- */
- public List getSupportedTypes() {
- ManagementBusDeploymentPluginTomcat.LOG.debug("Getting Types: {}.", ManagementBusDeploymentPluginTomcat.TYPES);
- final List types = new ArrayList<>();
-
- for (final String type : ManagementBusDeploymentPluginTomcat.TYPES.split("[,;]")) {
- types.add(type.trim());
- }
- return types;
- }
-
- @Override
- /**
- * {@inheritDoc}
- */
- public List getCapabilties() {
- ManagementBusDeploymentPluginTomcat.LOG.debug("Getting Plugin-Capabilities: {}.",
- ManagementBusDeploymentPluginTomcat.CAPABILITIES);
- final List capabilities = new ArrayList<>();
-
- for (final String capability : ManagementBusDeploymentPluginTomcat.CAPABILITIES.split("[,;]")) {
- capabilities.add(capability.trim());
- }
- return capabilities;
- }
-
- /**
- * Check if the Tomcat which is references as the IA-engine in the container config.ini is
- * running.
- *
- * @return true if Tomcat is running and can be accessed, false otherwise
- */
- private boolean isRunning() {
- ManagementBusDeploymentPluginTomcat.LOG.info("Checking if Tomcat is running on {} and can be accessed...",
- Settings.ENGINE_IA_TOMCAT_URL);
-
- // URL to get serverinfo from Tomcat
- final String url = Settings.ENGINE_IA_TOMCAT_URL + "/manager/text/serverinfo";
-
- // execute HTPP GET on URL and check the response
- try {
- final HttpResponse httpResponse =
- this.httpService.Get(url, Settings.ENGINE_IA_TOMCAT_USERNAME, Settings.ENGINE_IA_TOMCAT_PASSWORD);
-
- final String response = IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8");
-
- ManagementBusDeploymentPluginTomcat.LOG.debug(response);
-
- if (response.contains("OK - Server info")) {
- return true;
- }
- }
- catch (final Exception e) {
- ManagementBusDeploymentPluginTomcat.LOG.error("Error while checking for availability of the Tomcat: {}",
- e.getMessage());
- }
-
- return false;
- }
-
- /**
- * Check if the artifact references contain a WAR-File and return the URL to the file if so.
- *
- * @param artifactReferences the references to check if a WAR-File is available
- * @return the URL to the file or null if no file is found
- */
- private URL getWARFileReference(final List artifactReferences) {
- ManagementBusDeploymentPluginTomcat.LOG.info("Searching for a reference to a WAR-File...");
-
- if (artifactReferences != null) {
- for (final String reference : artifactReferences) {
-
- // check if reference targets a WAR-File
- if (reference.toLowerCase().endsWith(".war")) {
- ManagementBusDeploymentPluginTomcat.LOG.info("Found WAR-File reference: {}", reference);
- try {
- return new URL(reference);
- }
- catch (final MalformedURLException e) {
- ManagementBusDeploymentPluginTomcat.LOG.error("Failed to convert the reference to a URL: {}",
- e.getMessage());
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Retrieve the WAR-File from the given URL and store it as local temp file.
- *
- * @param warURL the URL to the WAR-File that shall be retrieved
- * @return the file if retrieval was successful, null otherwise
- */
- private File getWarFile(final URL warURL) {
- ManagementBusDeploymentPluginTomcat.LOG.info("Trying to retrieve WAR-File from URL: {}", warURL);
-
- if (warURL != null) {
- try {
- // store WAR artifact as temporary file
- final File tempFile = File.createTempFile("Artifact", ".war");
- tempFile.deleteOnExit();
- FileUtils.copyURLToFile(warURL, tempFile);
- return tempFile;
- }
- catch (final IOException e) {
- ManagementBusDeploymentPluginTomcat.LOG.error("Failed to retrieve WAR-File: {}", e.getMessage());
- }
- }
- return null;
- }
-
-
- /**
- * Deploy the given WAR-File on the Tomcat. As path on Tomcat the host name of the triggering
- * OpenTOSCA Container and the NodeTypeImplementation with removed special characters (except
- * '-' and '_') concatenated with the name of the WAR-File (without ".war") is used:
- * /[Container-Hostname]/[TypeImplementationID]/[File-Name]
- *
- * @param warFile the WAR artifact that has to be deployed
- * @param triggeringContainer the host name of the OpenTOSCA Container that triggered the IA
- * deployment
- * @param typeImplementation the NodeTypeImplementation or RelationshipTypeImplementation which
- * is used to create a unique path where the WAR is deployed
- * @param fileName the file name which is part of the deployment path
- * @return
- */
- private String deployWAROnTomcat(final File warFile, final String triggeringContainer,
- final QName typeImplementation, final String fileName) {
-
- String endpoint = null;
-
- if (triggeringContainer != null) {
- if (typeImplementation != null) {
- // path where the WAR is deployed on the Tomcat
- final String deployPath = "/" + getConvertedString(triggeringContainer) + "/"
- + getConvertedString(typeImplementation.toString()) + "/" + fileName;
-
- // command to perform deployment on Tomcat from local file
- final String deploymentURL =
- Settings.ENGINE_IA_TOMCAT_URL + "/manager/text/deploy?update=true&path=" + deployPath;
-
- // create HttpEntity which contains the WAR-File
- final MultipartEntityBuilder builder = MultipartEntityBuilder.create();
- builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
- final FileBody fileBody = new FileBody(warFile);
- builder.addPart(fileName + ".war", fileBody);
- final HttpEntity entity = builder.build();
-
- try {
- // perform deployment request on Tomcat
- final HttpResponse httpResponse =
- this.httpService.Put(deploymentURL, entity, Settings.ENGINE_IA_TOMCAT_USERNAME,
- Settings.ENGINE_IA_TOMCAT_PASSWORD);
-
- final String response = IOUtils.toString(httpResponse.getEntity().getContent(), "UTF-8");
-
- ManagementBusDeploymentPluginTomcat.LOG.info("Tomcat response to deployment request: {}", response);
-
- // check if WAR-File was deployed successfully.
- if (response.contains("OK - Deployed application at context path " + deployPath)
- | response.contains("OK - Deployed application at context path [" + deployPath + "]")) {
- ManagementBusDeploymentPluginTomcat.LOG.info("Deployment was successful.");
-
- // concatenate service endpoint
- endpoint = Settings.ENGINE_IA_TOMCAT_URL + deployPath;
-
- ManagementBusDeploymentPluginTomcat.LOG.info("Endpoint of deployed service: {}", endpoint);
- } else {
- ManagementBusDeploymentPluginTomcat.LOG.error("Deployment was not successful.");
- }
- }
- catch (final IOException e) {
- ManagementBusDeploymentPluginTomcat.LOG.error("IOException occured while deploying the WAR-File: {}!",
- e);
- }
- } else {
- ManagementBusDeploymentPluginTomcat.LOG.warn("NodeTypeImplementation ID is null. Deployment aborted because the ID is part of the deployment path on Tomcat");
- }
- } else {
- ManagementBusDeploymentPluginTomcat.LOG.warn("Triggering Container host name is null. Deployment aborted because it is part of the deployment path on Tomcat");
- }
-
- return endpoint;
- }
-
- /**
- * Remove invalid characters from the provided String.
- *
- * @param string the String to convert
- * @return String with replaced '.' by "-" and removed remaining special characters (except '-'
- * and '_').
- */
- private String getConvertedString(final String string) {
-
- ManagementBusDeploymentPluginTomcat.LOG.debug("Converting String: {}", string);
-
- // replace '.' by '-' to leave IPs unique
- String convertedString = string.replace(".", "-");
-
- // remove all special characters except '-' and '_'
- convertedString = convertedString.replaceAll("[^-a-zA-Z0-9_]", "");
-
- ManagementBusDeploymentPluginTomcat.LOG.debug("Converted string: {}", convertedString);
-
- return convertedString;
- }
-
- /**
- * Convert a String to an URI
- *
- * @param string the String that has to be converted to URI
- * @return URI representation of the String if convertible, null otherwise
- */
- private URI getURI(final String string) {
- URI uri = null;
- if (string != null) {
- try {
- uri = new URI(string);
- }
- catch (final URISyntaxException e) {
- ManagementBusDeploymentPluginTomcat.LOG.error("Failed to transform String to URI: {} ", string);
- }
- }
- return uri;
- }
-
- /**
- * Register IHTTPService.
- *
- * @param service - A IHTTPService to register.
- */
- public void bindHTTPService(final IHTTPService httpService) {
- if (httpService != null) {
- this.httpService = httpService;
- LOG.debug("Register IHTTPService: {} registered.", httpService.toString());
- } else {
- LOG.error("Register IHTTPService: Supplied parameter is null!");
- }
- }
-
- /**
- * Unregister IHTTPService.
- *
- * @param service - A IHTTPService to unregister.
- */
- public void unbindHTTPService(final IHTTPService httpService) {
- this.httpService = null;
- LOG.debug("Unregister IHTTPService: {} unregistered.", httpService.toString());
- }
-}
diff --git a/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/util/Messages.java b/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/util/Messages.java
deleted file mode 100644
index d0e83fc98..000000000
--- a/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/util/Messages.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.opentosca.bus.management.deployment.plugin.tomcat.util;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Utility class to define Strings in messages.properties.
- */
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
- public static String DeploymentPluginTomcat_types;
- public static String DeploymentPluginTomcat_capabilities;
- static {
- // initialize resource bundle
- NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {}
-}
diff --git a/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/util/messages.properties b/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/util/messages.properties
deleted file mode 100644
index 881571708..000000000
--- a/org.opentosca.bus.management.deployment.plugin.tomcat/src/org/opentosca/bus/management/deployment/plugin/tomcat/util/messages.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-# Contains the type of the plugin as well as provided capabilities.
-DeploymentPluginTomcat_types={http://www.example.com/ToscaTypes}WAR,{http://opentosca.org/artifacttypes}WAR
-DeploymentPluginTomcat_capabilities=http://tomcat.apache.org/tomcat7.0, http://www.jcp.org/javaserverpages2.2 , http://www.jcp.org/servlet3.0
\ No newline at end of file
diff --git a/org.opentosca.bus.management.deployment.plugin/META-INF/MANIFEST.MF b/org.opentosca.bus.management.deployment.plugin/META-INF/MANIFEST.MF
deleted file mode 100644
index 662ee75a1..000000000
--- a/org.opentosca.bus.management.deployment.plugin/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,9 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.opentosca.bus.management.deployment.plugin
-Bundle-SymbolicName: org.opentosca.bus.management.deployment.plugin
-Bundle-Version: 2.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.opentosca.bus.management.deployment.plugin
-Import-Package: org.apache.camel;version="2.10.4",
- org.opentosca.bus.management.header
diff --git a/org.opentosca.bus.management.deployment.plugin/build.properties b/org.opentosca.bus.management.deployment.plugin/build.properties
deleted file mode 100644
index b107977f4..000000000
--- a/org.opentosca.bus.management.deployment.plugin/build.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .
diff --git a/org.opentosca.bus.management.deployment.plugin/pom.xml b/org.opentosca.bus.management.deployment.plugin/pom.xml
deleted file mode 100644
index 42eb3a6be..000000000
--- a/org.opentosca.bus.management.deployment.plugin/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.management.deployment.plugin
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.deployment.plugin/src/org/opentosca/bus/management/deployment/plugin/IManagementBusDeploymentPluginService.java b/org.opentosca.bus.management.deployment.plugin/src/org/opentosca/bus/management/deployment/plugin/IManagementBusDeploymentPluginService.java
deleted file mode 100644
index 7d4b007f5..000000000
--- a/org.opentosca.bus.management.deployment.plugin/src/org/opentosca/bus/management/deployment/plugin/IManagementBusDeploymentPluginService.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.opentosca.bus.management.deployment.plugin;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.opentosca.bus.management.header.MBHeader;
-
-/**
- * Interface of the Management Bus Deployment Plug-ins.
- *
- *
- * Copyright 2018 IAAS University of Stuttgart
- *
- *
- * The interface specifies four methods. One for invoking the deployment of an Implementation
- * Artifact, another for invoking the undeployment of a previously deployed Implementation Artifact
- * and two methods that return the supported deployment types and the capabilities of the specific
- * plug-in.
- *
- */
-public interface IManagementBusDeploymentPluginService {
-
- /**
- * Invokes the deployment of an Implementation Artifact.
- *
- * @param exchange contains all needed information like the NodeTypeImplementation the
- * ArtifactReferences to the files that have to be deployed and the "ServiceEndpoint"
- * property if it is defined.
- *
- * @return the endpoint of the deployed Implementation Artifact as header field (see
- * {@link MBHeader#ENDPOINT_URI}) of the exchange message or null if the deployment
- * failed.
- *
- */
- public Exchange invokeImplementationArtifactDeployment(Exchange exchange);
-
- /**
- * Invokes the undeployment of an Implementation Artifact.
- *
- * @param exchange contains all needed information like the endpoint of the deployed
- * Implementation Artifact.
- *
- * @return the result of the undeployment process as header field (see
- * {@link MBHeader#OPERATIONSTATE_BOOLEAN}) of the exchange message.
- *
- */
- public Exchange invokeImplementationArtifactUndeployment(Exchange exchange);
-
- /**
- * Returns the supported deployment-types of the plug-in.
- *
- * @return list of strings each representing one supported deployment type of the plug-in.
- *
- */
- public List getSupportedTypes();
-
- /**
- * Returns the provided capabilities of the plug-in.
- *
- * @return list of strings each representing one capability of the plug-in.
- *
- */
- public List getCapabilties();
-}
diff --git a/org.opentosca.bus.management.invocation.plugin.remote/META-INF/MANIFEST.MF b/org.opentosca.bus.management.invocation.plugin.remote/META-INF/MANIFEST.MF
deleted file mode 100644
index 4802cd951..000000000
--- a/org.opentosca.bus.management.invocation.plugin.remote/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,20 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.opentosca.bus.management.invocation.plugin.remote
-Bundle-SymbolicName: org.opentosca.bus.management.invocation.plugin.remote
-Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.opentosca.bus.management.invocation.plugin.remote.Activator
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.apache.camel;version="2.10.4",
- org.apache.camel.builder;version="2.10.4",
- org.apache.camel.impl;version="2.18.3",
- org.opentosca.bus.management.service.impl,
- org.opentosca.bus.management.service.impl.collaboration,
- org.opentosca.bus.management.service.impl.collaboration.model,
- org.osgi.framework;version="1.3.0",
- org.slf4j;version="1.7.5"
-Service-Component: OSGI-INF/*
-Bundle-ActivationPolicy: lazy
-Require-Bundle: org.opentosca.container.core;bundle-version="1.0.0",
- org.opentosca.bus.management;bundle-version="1.0.0",
- org.opentosca.bus.management.invocation.plugin;bundle-version="1.0.0"
diff --git a/org.opentosca.bus.management.invocation.plugin.remote/OSGI-INF/ManagementBusInvocationPluginRemote - component.xml b/org.opentosca.bus.management.invocation.plugin.remote/OSGI-INF/ManagementBusInvocationPluginRemote - component.xml
deleted file mode 100644
index d9b8f8776..000000000
--- a/org.opentosca.bus.management.invocation.plugin.remote/OSGI-INF/ManagementBusInvocationPluginRemote - component.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/org.opentosca.bus.management.invocation.plugin.remote/build.properties b/org.opentosca.bus.management.invocation.plugin.remote/build.properties
deleted file mode 100644
index d6642e652..000000000
--- a/org.opentosca.bus.management.invocation.plugin.remote/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
diff --git a/org.opentosca.bus.management.invocation.plugin.remote/pom.xml b/org.opentosca.bus.management.invocation.plugin.remote/pom.xml
deleted file mode 100644
index 0bc327ab8..000000000
--- a/org.opentosca.bus.management.invocation.plugin.remote/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.management.invocation.plugin.remote
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.invocation.plugin.remote/src/org/opentosca/bus/management/invocation/plugin/remote/Activator.java b/org.opentosca.bus.management.invocation.plugin.remote/src/org/opentosca/bus/management/invocation/plugin/remote/Activator.java
deleted file mode 100644
index 2b4c13e3e..000000000
--- a/org.opentosca.bus.management.invocation.plugin.remote/src/org/opentosca/bus/management/invocation/plugin/remote/Activator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.opentosca.bus.management.invocation.plugin.remote;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Activator of the Remote-Invocation-Management-Bus-Plug-in.
- *
- *
- * Copyright 2018 IAAS University of Stuttgart
- *
- *
- * @author Benjamin Weder- st100495@stud.uni-stuttgart.de
- *
- */
-public class Activator implements BundleActivator {
-
- final private static Logger LOG = LoggerFactory.getLogger(Activator.class);
-
- static BundleContext context;
-
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
- Activator.LOG.info("Starting bundle \"{}\" ({})...", bundleContext.getBundle().getSymbolicName(),
- bundleContext.getBundle().getVersion());
- context = bundleContext;
- }
-
- @Override
- public void stop(final BundleContext bundleContext) throws Exception {
- Activator.LOG.info("Stopping bundle \"{}\" ({})...", bundleContext.getBundle().getSymbolicName(),
- bundleContext.getBundle().getVersion());
- Activator.context = null;
- }
-}
diff --git a/org.opentosca.bus.management.invocation.plugin.rest/META-INF/MANIFEST.MF b/org.opentosca.bus.management.invocation.plugin.rest/META-INF/MANIFEST.MF
deleted file mode 100644
index 6ffb08520..000000000
--- a/org.opentosca.bus.management.invocation.plugin.rest/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.opentosca.bus.management.invocation.plugin.rest
-Bundle-SymbolicName: org.opentosca.bus.management.invocation.plugin.rest
-Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.opentosca.bus.management.invocation.plugin.rest.Activator
-Bundle-ActivationPolicy: lazy
-Import-Package: com.google.gson;version="2.2.4",
- org.apache.camel;version="2.10.4",
- org.apache.camel.builder;version="2.10.4",
- org.apache.camel.core.osgi;version="2.10.4",
- org.apache.camel.impl;version="2.10.4",
- org.apache.camel.model;version="2.10.4",
- org.apache.http;version="4.2.1",
- org.apache.http.client.utils;version="4.2.0",
- org.eclipse.osgi.util;version="1.1.0",
- org.osgi.framework;version="1.3.0",
- org.slf4j;version="1.7.5"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.opentosca.container.core;bundle-version="1.0.0",
- org.opentosca.bus.management;bundle-version="1.0.0",
- org.opentosca.bus.management.invocation.plugin;bundle-version="1.0.0"
-Service-Component: OSGI-INF/*
diff --git a/org.opentosca.bus.management.invocation.plugin.rest/OSGI-INF/ManagementBusInvocationPluginRest - component.xml b/org.opentosca.bus.management.invocation.plugin.rest/OSGI-INF/ManagementBusInvocationPluginRest - component.xml
deleted file mode 100644
index 5d65954f7..000000000
--- a/org.opentosca.bus.management.invocation.plugin.rest/OSGI-INF/ManagementBusInvocationPluginRest - component.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/org.opentosca.bus.management.invocation.plugin.rest/build.properties b/org.opentosca.bus.management.invocation.plugin.rest/build.properties
deleted file mode 100644
index d6642e652..000000000
--- a/org.opentosca.bus.management.invocation.plugin.rest/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/
diff --git a/org.opentosca.bus.management.invocation.plugin.rest/pom.xml b/org.opentosca.bus.management.invocation.plugin.rest/pom.xml
deleted file mode 100644
index 87bff57de..000000000
--- a/org.opentosca.bus.management.invocation.plugin.rest/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.management.invocation.plugin.rest
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/Activator.java b/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/Activator.java
deleted file mode 100644
index cbd894c56..000000000
--- a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/Activator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.opentosca.bus.management.invocation.plugin.rest;
-
-import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Activator of the REST/HTTP-Invocation-Management Bus-Plug-in.
- *
- *
- * Copyright 2013 IAAS University of Stuttgart
- *
- *
- * The activator is needed to start the camel context.
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- */
-public class Activator implements BundleActivator {
-
- public static DefaultCamelContext camelContext;
-
- final private static Logger LOG = LoggerFactory.getLogger(Activator.class);
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext )
- */
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
- Activator.camelContext = new OsgiDefaultCamelContext(bundleContext);
- Activator.camelContext.start();
- Activator.LOG.info("REST-INVOCATION-PLUGIN-STARTED");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(final BundleContext bundleContext) throws Exception {
- Activator.camelContext = null;
- Activator.LOG.info("REST-INVOCATION-PLUGIN-STOPPED");
- }
-
-}
diff --git a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/ManagementBusInvocationPluginRest.java b/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/ManagementBusInvocationPluginRest.java
deleted file mode 100644
index 1bb552cb4..000000000
--- a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/ManagementBusInvocationPluginRest.java
+++ /dev/null
@@ -1,580 +0,0 @@
-package org.opentosca.bus.management.invocation.plugin.rest;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.ProducerTemplate;
-import org.opentosca.bus.management.header.MBHeader;
-import org.opentosca.bus.management.invocation.plugin.IManagementBusInvocationPluginService;
-import org.opentosca.bus.management.invocation.plugin.rest.model.ContentType;
-import org.opentosca.bus.management.invocation.plugin.rest.model.DataAssign;
-import org.opentosca.bus.management.invocation.plugin.rest.model.DataAssign.Operations.Operation;
-import org.opentosca.bus.management.invocation.plugin.rest.util.Messages;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.traversal.DocumentTraversal;
-import org.w3c.dom.traversal.NodeFilter;
-import org.w3c.dom.traversal.NodeIterator;
-import org.xml.sax.InputSource;
-
-import com.google.gson.JsonObject;
-
-/**
- * Management Bus-Plug-in for invoking a service over HTTP.
- *
- *
- * Copyright 2013 IAAS University of Stuttgart
- *
- *
- * The Plug-in gets needed information (like endpoint of the service or operation to invoke) from
- * the Management Bus and creates a HTTP message out of it. The Plug-in supports the transfer of
- * parameters via queryString (both in the URL and the body) and xml formatted in the body.
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- * @author Christian Endres - christian.endres@iaas.informatik.uni-stuttgart.de
- *
- */
-public class ManagementBusInvocationPluginRest implements IManagementBusInvocationPluginService {
-
-
- final private static Logger LOG = LoggerFactory.getLogger(ManagementBusInvocationPluginRest.class);
-
- // Supported types defined in messages.properties.
- static final private String TYPES = Messages.RestSIEnginePlugin_types;
-
- // Default Values of specific content
- final String PARAMS = "queryString";
- final String ENDPOINT = "no";
- final String CONTENTTYPE = "urlencoded";
- final String METHOD = "POST";
-
-
- @SuppressWarnings("unchecked")
- @Override
- public Exchange invoke(Exchange exchange) {
-
- final Message message = exchange.getIn();
-
- final Object params = message.getBody();
- final String operationName = message.getHeader(MBHeader.OPERATIONNAME_STRING.toString(), String.class);
- final String interfaceName = message.getHeader(MBHeader.INTERFACENAME_STRING.toString(), String.class);
- final String endpoint = message.getHeader(MBHeader.ENDPOINT_URI.toString(), String.class);
- final Document specificContenet =
- message.getHeader(MBHeader.SPECIFICCONTENT_DOCUMENT.toString(), Document.class);
-
- LOG.debug("Invoke REST call at {}.", endpoint);
-
- HashMap paramsMap = null;
- final Document paramsDoc = null;
- final boolean isDoc = false;
-
- if (params instanceof HashMap) {
- paramsMap = (HashMap) params;
- LOG.debug("params are hashmap: {}", mapToQueryString(paramsMap));
- // for (String str : paramsMap.keySet()) {
- // LOG.trace(" {}: {}", str, paramsMap.get(str));
- // }
- }
-
- else {
- LOG.error("Cannot map parameters to a map.");
- return null;
- }
-
- DataAssign dataAssign = null;
-
- if (specificContenet != null) {
-
- ManagementBusInvocationPluginRest.LOG.debug("Unmarshalling provided artifact specific content.");
- dataAssign = unmarshall(specificContenet);
- }
-
- Operation operation = null;
-
- if (dataAssign != null) {
-
- ManagementBusInvocationPluginRest.LOG.debug("Searching for correct operation.");
- operation = getOperation(dataAssign, operationName, interfaceName);
-
- }
-
- final Map headers = new HashMap<>();
- headers.put(Exchange.HTTP_URI, endpoint);
- headers.put(Exchange.HTTP_METHOD, this.METHOD);
- headers.put(Exchange.CONTENT_TYPE, "application/json");
-
- Object body = null;
-
- final ContentType contentTypeParam = ContentType.JSON;
-
- ManagementBusInvocationPluginRest.LOG.debug("ParamsParam set: params into payload.");
-
- // ...as xml
- if (contentTypeParam != null && !contentTypeParam.value().equalsIgnoreCase(this.CONTENTTYPE)) {
-
- ManagementBusInvocationPluginRest.LOG.debug("ContenttypeParam set: params into payload as {}.",
- contentTypeParam);
-
- body = mapToJSON(paramsMap);
- }
- // ...as urlencoded String
- else {
-
- ManagementBusInvocationPluginRest.LOG.debug("Params into payload as urlencoded String.");
-
- if (paramsDoc != null || paramsMap != null) {
- final String queryString = getQueryString(paramsDoc, paramsMap);
- body = queryString;
- }
-
- }
-
- final ProducerTemplate template = Activator.camelContext.createProducerTemplate();
- // the dummyhost uri is ignored, so this is ugly but intended
-
- // deployment of plan may be not finished at this point, thus, poll for
- // successful invocation
- String responseString = null;
- final long maxWaitTime = 5000;
- final long startMillis = System.currentTimeMillis();
- do {
-
- try {
- responseString = template.requestBodyAndHeaders("http://dummyhost", body, headers, String.class);
- }
- catch (final Exception e) {
- }
- LOG.trace(responseString);
-
- if (null != responseString) {
- break;
- } else if (System.currentTimeMillis() - startMillis > maxWaitTime) {
- final String str = "Wait time exceeded, stop waiting for response of operation.";
- LOG.error(str + "\n" + responseString);
- } else {
- LOG.trace("Waiting for being able to invoke Camunda BPMN plan for at most "
- + (maxWaitTime - System.currentTimeMillis() + startMillis) / 1000 + " seconds.");
- }
-
- try {
- Thread.sleep(1000);
- }
- catch (final InterruptedException e) {
- e.printStackTrace();
- }
- } while (null == responseString);
-
- LOG.info("Response of the REST call: " + responseString);
-
- exchange = createResponseExchange(exchange, responseString, operationName, isDoc);
-
- return exchange;
- }
-
- private Object mapToJSON(final HashMap paramsMap) {
- final JsonObject vars = new JsonObject();
- for (final String key : paramsMap.keySet()) {
- final JsonObject details = new JsonObject();
- details.addProperty("value", paramsMap.get(key));
- details.addProperty("type", "String");
- vars.add(key, details);
- }
- final JsonObject variables = new JsonObject();
- variables.add("variables", vars);
- LOG.debug("JSON request body: {}", variables.toString());
- return variables.toString();
- }
-
- /**
- * Returns the created queryString.
- *
- * @param paramsDoc to create queryString from.
- * @param paramsMap to create queryString from.
- * @return created queryString
- */
- private String getQueryString(final Document paramsDoc, HashMap paramsMap) {
-
- ManagementBusInvocationPluginRest.LOG.debug("Creating queryString...");
-
- if (paramsDoc != null) {
-
- paramsMap = docToMap(paramsDoc);
-
- }
-
- final String queryString = mapToQueryString(paramsMap);
-
- ManagementBusInvocationPluginRest.LOG.debug("Created queryString: {}", queryString);
-
- return queryString;
- }
-
- /**
- * Generates the queryString from the given params HashMap.
- *
- * @param params to generate the queryString from.
- *
- * @return the queryString.
- */
- private String mapToQueryString(final HashMap params) {
-
- ManagementBusInvocationPluginRest.LOG.debug("Transfering the map: {} into a queryString...", params);
-
- final StringBuilder query = new StringBuilder();
-
- for (final Entry entry : params.entrySet()) {
-
- query.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
-
- }
-
- // remove last "&"
- final int length = query.length();
-
- if (length > 0) {
-
- query.deleteCharAt(length - 1);
- }
-
- return query.toString();
-
- }
-
- /**
- * Transfers the given string (if it is valid xml) into Document. *
- *
- * @param string to generate Document from.
- * @return Document or null if string wasn't valid xml.
- */
- private Document stringToDoc(final String string) {
-
- final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder;
- Document doc = null;
- try {
- builder = factory.newDocumentBuilder();
- doc = builder.parse(new InputSource(new StringReader(string)));
-
- }
- catch (final Exception e) {
- ManagementBusInvocationPluginRest.LOG.debug("Response isn't xml.");
- return null;
- }
- return doc;
- }
-
- /**
- * Transfers the given string (if it is a valid queryString) into a HashMap.
- *
- * @param queryString to generate the map from.
- * @return HashMap or null if string wasn't a valid queryString.
- */
- private HashMap queryStringToMap(final String queryString) {
-
- ManagementBusInvocationPluginRest.LOG.debug("Transfering the queryString: {} into a HashMap...", queryString);
-
- final String[] params = queryString.split("&");
- final HashMap map = new HashMap<>();
- for (final String param : params) {
- try {
-
- final String name = param.split("=")[0];
- final String value = param.split("=")[1];
-
- if (name.matches("\\w+")) {
-
- map.put(name, value);
- }
-
- }
- catch (final IndexOutOfBoundsException e) {
- ManagementBusInvocationPluginRest.LOG.debug("Response isn't queryString.");
- return null;
- }
- }
-
- ManagementBusInvocationPluginRest.LOG.debug("Transfered HashMap: {}", map.toString());
- return map;
- }
-
- /**
- * Returns the http path that will be concatenated to the endpoint.
- *
- * @param operation
- * @return http path.
- */
- private String getHttpPath(final Operation operation) {
-
- final StringBuilder httpPath = new StringBuilder();
- final String intName = operation.getInterfaceName();
- final String opName = operation.getName();
-
- if (intName != null) {
- httpPath.append(intName);
- }
-
- if (opName != null) {
-
- if (intName != null) {
- httpPath.append("/").append(opName);
-
- } else {
- httpPath.append(opName);
- }
- }
-
- return httpPath.toString();
- }
-
- /**
- * Searches for the correct operation of the artifact specific content.
- *
- * @param dataAssign containing all operations.
- * @param operationName that will be searched for.
- * @param interfaceName that will be searched for.
- *
- * @return matching operation.
- */
- private Operation getOperation(final DataAssign dataAssign, final String operationName,
- final String interfaceName) {
-
- final List operations = dataAssign.getOperations().getOperation();
-
- for (final Operation op : operations) {
-
- final String provOpName = op.getName();
- final String provIntName = op.getInterfaceName();
-
- ManagementBusInvocationPluginRest.LOG.debug("Provided operation name: {}. Needed: {}", provOpName,
- operationName);
- ManagementBusInvocationPluginRest.LOG.debug("Provided interface name: {}. Needed: {}", provIntName,
- interfaceName);
-
- if (op.getName() == null && op.getInterfaceName() == null) {
- ManagementBusInvocationPluginRest.LOG.debug("Operation found. No operation name nor interfaceName is specified meaning this IA implements just one operation or the provided information count for all implemented operations.");
- return op;
-
- } else if (op.getName() != null && op.getName().equalsIgnoreCase(operationName)) {
-
- if (op.getInterfaceName() == null || interfaceName == null) {
- ManagementBusInvocationPluginRest.LOG.debug("Operation found. No interfaceName specified.");
- return op;
-
- } else if (op.getInterfaceName().equalsIgnoreCase(interfaceName)) {
- ManagementBusInvocationPluginRest.LOG.debug("Operation found. Interface name matches too.");
- return op;
-
- }
-
- } else if (op.getInterfaceName() != null && op.getName() == null
- && op.getInterfaceName().equalsIgnoreCase(interfaceName)) {
- ManagementBusInvocationPluginRest.LOG.debug("Operation found. Provided information count for all operations of the specified interface.");
- return op;
- }
- }
- return null;
- }
-
- /**
- * Transfers the document to a map.
- *
- * @param doc to be transfered to a map.
- * @return transfered map.
- */
- private HashMap docToMap(final Document doc) {
- final HashMap map = new HashMap<>();
-
- final DocumentTraversal traversal = (DocumentTraversal) doc;
- final NodeIterator iterator =
- traversal.createNodeIterator(doc.getDocumentElement(), NodeFilter.SHOW_ELEMENT, null, true);
-
- for (Node node = iterator.nextNode(); node != null; node = iterator.nextNode()) {
-
- final String name = ((Element) node).getTagName();
- final StringBuilder content = new StringBuilder();
- final NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- final Node child = children.item(i);
- if (child.getNodeType() == Node.TEXT_NODE) {
- content.append(child.getTextContent());
- }
- }
-
- if (!content.toString().trim().isEmpty()) {
- map.put(name, content.toString());
- }
- }
-
- return map;
- }
-
- /**
- * Transfers the paramsMap into a Document.
- *
- * @param operationName as root element.
- * @param paramsMap
- *
- * @return the created Document.
- */
- private Document mapToDoc(final String operationName, final HashMap paramsMap) {
-
- Document document;
-
- final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder documentBuilder = null;
- try {
- documentBuilder = documentBuilderFactory.newDocumentBuilder();
- }
- catch (final ParserConfigurationException e) {
- e.printStackTrace();
- }
-
- document = documentBuilder.newDocument();
-
- final Element rootElement = document.createElement(operationName);
- document.appendChild(rootElement);
-
- Element mapElement;
- for (final Entry entry : paramsMap.entrySet()) {
- mapElement = document.createElement(entry.getKey());
- mapElement.setTextContent(entry.getValue());
- rootElement.appendChild(mapElement);
-
- }
-
- return document;
- }
-
- /**
- * Alters the exchange with the response of the invoked service depending of the type of the
- * body.
- *
- * @param exchange to be altered.
- * @param responseString containing the response of the invoked service.
- * @param operationName
- * @param isDoc
- * @return exchange with response of the invokes service as body.
- *
- * @TODO: Response handling is a bit hacky. Should be updated sometime to determine the response
- * type with content-type header.
- */
- private Exchange createResponseExchange(final Exchange exchange, final String responseString,
- final String operationName, final boolean isDoc) {
-
- ManagementBusInvocationPluginRest.LOG.debug("Handling the response: {}.", responseString);
-
- Document responseDoc = stringToDoc(responseString);
- HashMap responseMap;
-
- // response was xml
- if (responseDoc != null) {
-
- ManagementBusInvocationPluginRest.LOG.debug("Reponse is xml formatted.");
-
- if (isDoc) {
-
- ManagementBusInvocationPluginRest.LOG.debug("Returning response xml formatted..");
- exchange.getIn().setBody(responseDoc);
-
- } else {
-
- ManagementBusInvocationPluginRest.LOG.debug("Transfering xml response into a Hashmap...");
- responseMap = docToMap(responseDoc);
- ManagementBusInvocationPluginRest.LOG.debug("Returning response as HashMap.");
- exchange.getIn().setBody(responseMap);
- }
- }
- // response should be queryString
- else {
-
- responseMap = queryStringToMap(responseString);
-
- if (responseMap == null || responseMap.isEmpty()) {
- ManagementBusInvocationPluginRest.LOG.debug("Response isn't neihter xml nor queryString. Returning the reponse: {} as string.",
- responseString);
- exchange.getIn().setBody(responseString);
- }
-
- else if (isDoc) {
-
- ManagementBusInvocationPluginRest.LOG.debug("Transfering response into xml...");
- responseDoc = mapToDoc(operationName, responseMap);
-
- exchange.getIn().setBody(responseDoc);
-
- } else {
- ManagementBusInvocationPluginRest.LOG.debug("Returning response as HashMap.");
- exchange.getIn().setBody(responseMap);
- }
- }
-
- return exchange;
- }
-
- /**
- * Unmarshalls the provided artifact specific content.
- *
- * @param doc to unmarshall.
- *
- * @return DataAssign object.
- */
- private DataAssign unmarshall(final Document doc) {
-
- final NodeList nodeList =
- doc.getElementsByTagNameNS("http://www.siengine.restplugin.org/SpecificContentRestSchema", "DataAssign");
-
- final Node node = nodeList.item(0);
-
- JAXBContext jc;
-
- try {
-
- jc = JAXBContext.newInstance("org.opentosca.bus.management.plugins.rest.service.impl.model");
- final Unmarshaller unmarshaller = jc.createUnmarshaller();
- final DataAssign dataAssign = (DataAssign) unmarshaller.unmarshal(node);
-
- ManagementBusInvocationPluginRest.LOG.debug("Artifact specific content successfully marshalled.");
-
- return dataAssign;
-
- }
- catch (final JAXBException e) {
- ManagementBusInvocationPluginRest.LOG.warn("Couldn't unmarshall provided artifact specific content!");
- e.printStackTrace();
- }
-
- ManagementBusInvocationPluginRest.LOG.debug("No unmarshallable artifact specific content provided. Using default values now.");
-
- return null;
- }
-
- @Override
- public List getSupportedTypes() {
- ManagementBusInvocationPluginRest.LOG.debug("Getting Types: {}.", ManagementBusInvocationPluginRest.TYPES);
- final List types = new ArrayList<>();
-
- for (final String type : ManagementBusInvocationPluginRest.TYPES.split("[,;]")) {
- types.add(type.trim());
- }
- return types;
- }
-
-}
diff --git a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/model/ObjectFactory.java b/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/model/ObjectFactory.java
deleted file mode 100644
index 5f834903a..000000000
--- a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/model/ObjectFactory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.07.29 at 03:39:23 PM MESZ
-//
-
-
-package org.opentosca.bus.management.invocation.plugin.rest.model;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each Java content interface and Java element interface
- * generated in the org.opentosca.bus.management.invocation.plugin.rest.model package.
- *
- * An ObjectFactory allows you to programatically construct new instances of the Java representation
- * for XML content. The Java representation of XML content can consist of schema derived interfaces
- * and classes representing the binding of schema type definitions, element declarations and model
- * groups. Factory methods for each of these are provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes
- * for package: org.opentosca.bus.management.plugins.rest.service.impl.model
- *
- */
- public ObjectFactory() {}
-
- /**
- * Create an instance of {@link DataAssign }
- *
- */
- public DataAssign createDataAssign() {
- return new DataAssign();
- }
-
- /**
- * Create an instance of {@link DataAssign.Operations.Operation }
- *
- */
- public DataAssign.Operations.Operation createDataAssignOperationsOperation() {
- return new DataAssign.Operations.Operation();
- }
-
- /**
- * Create an instance of {@link DataAssign.Operations }
- *
- */
- public DataAssign.Operations createDataAssignOperations() {
- return new DataAssign.Operations();
- }
-
-}
diff --git a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/model/package-info.java b/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/model/package-info.java
deleted file mode 100644
index 5bdea8580..000000000
--- a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/model/package-info.java
+++ /dev/null
@@ -1,11 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, vJAXB 2.1.10 in JDK 6
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.07.29 at 03:39:23 PM MESZ
-//
-
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.siengine.restplugin.org/SpecificContentRestSchema",
- elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
-package org.opentosca.bus.management.invocation.plugin.rest.model;
diff --git a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/util/Messages.java b/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/util/Messages.java
deleted file mode 100644
index 15c24d9b4..000000000
--- a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/util/Messages.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.opentosca.bus.management.invocation.plugin.rest.util;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Utility class to define Strings in messages.properties.
- *
- *
- * Copyright 2013 IAAS University of Stuttgart
- *
- *
- * @author Michael Zimmermann - zimmerml@studi.informatik.uni-stuttgart.de
- *
- *
- */
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.opentosca.bus.management.invocation.plugin.rest.util.messages"; //$NON-NLS-1$
- public static String RestSIEnginePlugin_types;
- static {
- // initialize resource bundle
- NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class);
- }
-
-
- private Messages() {}
-}
diff --git a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/util/messages.properties b/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/util/messages.properties
deleted file mode 100644
index 62600da27..000000000
--- a/org.opentosca.bus.management.invocation.plugin.rest/src/org/opentosca/bus/management/invocation/plugin/rest/util/messages.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-# Contains the supported types of the plugin as comma separated list.
-RestSIEnginePlugin_types=REST
diff --git a/org.opentosca.bus.management.invocation.plugin.script/META-INF/MANIFEST.MF b/org.opentosca.bus.management.invocation.plugin.script/META-INF/MANIFEST.MF
deleted file mode 100644
index 676601177..000000000
--- a/org.opentosca.bus.management.invocation.plugin.script/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,27 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.opentosca.bus.management.invocation.plugin.script
-Bundle-SymbolicName: org.opentosca.bus.management.invocation.plugin.script
-Bundle-Version: 2.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Bundle-ActivationPolicy: lazy
-Import-Package:
- org.apache.camel;version="2.10.4",
- org.apache.camel.builder;version="2.10.4",
- org.apache.camel.component.http;version="2.10.4",
- org.apache.camel.core.osgi;version="2.10.4",
- org.apache.camel.impl;version="2.10.4",
- org.apache.camel.model;version="2.10.4",
- org.apache.commons.io;version="2.2.0",
- org.eclipse.core.runtime;common=split;version="[3.1.0,4.0.0)",
- org.eclipse.osgi.util;version="1.1.0",
- org.osgi.framework;version="1.3.0",
- org.slf4j;version="1.7.5"
-Service-Component: OSGI-INF/*
-Bundle-Activator: org.opentosca.bus.management.invocation.plugin.script.Activator
-Require-Bundle: org.opentosca.container.core;bundle-version="1.0.0",
- org.opentosca.container.core.tosca;bundle-version="1.0.0",
- org.opentosca.bus.management;bundle-version="1.0.0",
- org.opentosca.bus.management.invocation.plugin;bundle-version="1.0.0",
- org.apache.commons.lang3
-Export-Package: org.opentosca.bus.management.invocation.plugin.script
diff --git a/org.opentosca.bus.management.invocation.plugin.script/OSGI-INF/ManagementBusInvocationPluginScript - component.xml b/org.opentosca.bus.management.invocation.plugin.script/OSGI-INF/ManagementBusInvocationPluginScript - component.xml
deleted file mode 100644
index 6bd7dbd16..000000000
--- a/org.opentosca.bus.management.invocation.plugin.script/OSGI-INF/ManagementBusInvocationPluginScript - component.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/org.opentosca.bus.management.invocation.plugin.script/OSGI-INF/ServiceHandler - component.xml b/org.opentosca.bus.management.invocation.plugin.script/OSGI-INF/ServiceHandler - component.xml
deleted file mode 100644
index 807cb822b..000000000
--- a/org.opentosca.bus.management.invocation.plugin.script/OSGI-INF/ServiceHandler - component.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/org.opentosca.bus.management.invocation.plugin.script/build.properties b/org.opentosca.bus.management.invocation.plugin.script/build.properties
deleted file mode 100644
index 98d41e652..000000000
--- a/org.opentosca.bus.management.invocation.plugin.script/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/,
diff --git a/org.opentosca.bus.management.invocation.plugin.script/pom.xml b/org.opentosca.bus.management.invocation.plugin.script/pom.xml
deleted file mode 100644
index d31c455aa..000000000
--- a/org.opentosca.bus.management.invocation.plugin.script/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- 4.0.0
-
-
- org.opentosca
- container
- 2.0.0-SNAPSHOT
-
-
- org.opentosca.bus.management.invocation.plugin.script
- eclipse-plugin
-
-
diff --git a/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/Activator.java b/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/Activator.java
deleted file mode 100644
index bec0ae3bd..000000000
--- a/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/Activator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.opentosca.bus.management.invocation.plugin.script;
-
-import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.opentosca.bus.management.invocation.plugin.script.typeshandler.ArtifactTypesHandler;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Activator of the Script-Invocation-Management-Bus-Plug-in.
- *
- *
- *
- * The activator is needed to start the camel context.
- *
- *
- * @author Michael Zimmermann - michael.zimmermann@iaas.uni-stuttgart.de
- *
- */
-public class Activator implements BundleActivator {
-
- public static DefaultCamelContext camelContext;
-
- final private static Logger LOG = LoggerFactory.getLogger(Activator.class);
-
- public static String bundleID;
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext )
- */
- @Override
- public void start(final BundleContext bundleContext) throws Exception {
-
- Activator.bundleID = bundleContext.getBundle().getSymbolicName();
- Activator.camelContext = new OsgiDefaultCamelContext(bundleContext);
- Activator.camelContext.start();
-
- ArtifactTypesHandler.init(bundleContext);
-
- Activator.LOG.info("Script-IA-Management Bus-PLUGIN-STARTED");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(final BundleContext bundleContext) throws Exception {
- Activator.camelContext = null;
- Activator.LOG.info("Script-IA-Management Bus-PLUGIN-STOPPED");
- }
-
-}
diff --git a/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/ManagementBusInvocationPluginScript.java b/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/ManagementBusInvocationPluginScript.java
deleted file mode 100644
index 98bd345bf..000000000
--- a/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/ManagementBusInvocationPluginScript.java
+++ /dev/null
@@ -1,764 +0,0 @@
-package org.opentosca.bus.management.invocation.plugin.script;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import javax.xml.namespace.QName;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.ProducerTemplate;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.opentosca.bus.management.header.MBHeader;
-import org.opentosca.bus.management.invocation.plugin.IManagementBusInvocationPluginService;
-import org.opentosca.bus.management.invocation.plugin.script.servicehandler.ServiceHandler;
-import org.opentosca.bus.management.invocation.plugin.script.typeshandler.ArtifactTypesHandler;
-import org.opentosca.bus.management.utils.MBUtils;
-import org.opentosca.container.core.common.Settings;
-import org.opentosca.container.core.engine.ResolvedArtifacts;
-import org.opentosca.container.core.engine.ResolvedArtifacts.ResolvedDeploymentArtifact;
-import org.opentosca.container.core.model.csar.id.CSARID;
-import org.opentosca.container.core.next.model.NodeTemplateInstance;
-import org.opentosca.container.core.tosca.convention.Interfaces;
-import org.opentosca.container.core.tosca.convention.Types;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Management Bus-Plug-in for Script IAs which have to be executed on a host machine.
- *
- *
- *
- *
- * The Plugin gets needed information from the Management Bus and is responsible for the uploading
- * of the files and the installation of required packages on the target machine (if specified).
- *
- *
- *
- * @author Michael Zimmermann - michael.zimmermann@iaas.uni-stuttgart.de
- *
- *
- */
-public class ManagementBusInvocationPluginScript implements IManagementBusInvocationPluginService {
-
- final private static String PLACEHOLDER_TARGET_FILE_PATH = "{TARGET_FILE_PATH}";
- final private static String PLACEHOLDER_TARGET_FILE_FOLDER_PATH = "{TARGET_FILE_FOLDER_PATH}";
- final private static String PLACEHOLDER_TARGET_FILE_NAME_WITH_EXTENSION = "{TARGET_FILE_NAME_WITH_E}";
- final private static String PLACEHOLDER_TARGET_FILE_NAME_WITHOUT_EXTENSION = "{TARGET_FILE_NAME_WITHOUT_E}";
- final private static String PLACEHOLDER_DA_NAME_PATH_MAP = "{DA_NAME_PATH_MAP}";
- final private static String PLACEHOLDER_DA_INPUT_PARAMETER = "{INPUT_PARAMETER}";
-
- final private static String RUN_SCRIPT_OUTPUT_PARAMETER_NAME = "ScriptResult";
-
- final private static Logger LOG = LoggerFactory.getLogger(ManagementBusInvocationPluginScript.class);
-
-
- @Override
- public Exchange invoke(final Exchange exchange) {
-
- final Message message = exchange.getIn();
-
- ManagementBusInvocationPluginScript.LOG.debug("Management Bus Script Plugin getting information...");
-
- final CSARID csarID = message.getHeader(MBHeader.CSARID.toString(), CSARID.class);
- ManagementBusInvocationPluginScript.LOG.debug("CsarID: {}", csarID);
- final QName artifactTemplateID = message.getHeader(MBHeader.ARTIFACTTEMPLATEID_QNAME.toString(), QName.class);
- ManagementBusInvocationPluginScript.LOG.debug("ArtifactTemplateID: {}", artifactTemplateID);
- String nodeTemplateID = message.getHeader(MBHeader.NODETEMPLATEID_STRING.toString(), String.class);
- ManagementBusInvocationPluginScript.LOG.debug("NodeTemplateID: {}", nodeTemplateID);
- final String relationshipTemplateID =
- message.getHeader(MBHeader.RELATIONSHIPTEMPLATEID_STRING.toString(), String.class);
- ManagementBusInvocationPluginScript.LOG.debug("RelationshipTemplateID: {}", relationshipTemplateID);
- final QName serviceTemplateID = message.getHeader(MBHeader.SERVICETEMPLATEID_QNAME.toString(), QName.class);
- ManagementBusInvocationPluginScript.LOG.debug("ServiceTemplateID: {}", serviceTemplateID);
- final String interfaceName = message.getHeader(MBHeader.INTERFACENAME_STRING.toString(), String.class);
- ManagementBusInvocationPluginScript.LOG.debug("InterfaceName: {}", interfaceName);
- final String operationName = message.getHeader(MBHeader.OPERATIONNAME_STRING.toString(), String.class);
- ManagementBusInvocationPluginScript.LOG.debug("OperationName: {}", operationName);
- final URI serviceInstanceID = message.getHeader(MBHeader.SERVICEINSTANCEID_URI.toString(), URI.class);
- ManagementBusInvocationPluginScript.LOG.debug("ServiceInstanceID: {}", serviceInstanceID);
- final String nodeInstanceID = message.getHeader(MBHeader.NODEINSTANCEID_STRING.toString(), String.class);
- ManagementBusInvocationPluginScript.LOG.debug("NodeInstanceID: {}", nodeInstanceID);
-
- CSARID tempCsarID = null;
- String tempNodeTemplateID = null;
- QName tempServiceTemplateID = null;
-
- if (nodeTemplateID == null && relationshipTemplateID != null) {
-
- final QName relationshipTypeID =
- ServiceHandler.toscaEngineService.getRelationshipTypeOfRelationshipTemplate(csarID, serviceTemplateID,
- relationshipTemplateID);
-
- final boolean isBoundToSourceNode =
- ServiceHandler.toscaEngineService.isOperationOfRelationshipBoundToSourceNode(csarID, relationshipTypeID,
- interfaceName,
- operationName);
-
- if (isBoundToSourceNode) {
- nodeTemplateID =
- ServiceHandler.toscaEngineService.getSourceNodeTemplateIDOfRelationshipTemplate(csarID,
- serviceTemplateID,
- relationshipTemplateID);
- } else {
- nodeTemplateID =
- ServiceHandler.toscaEngineService.getTargetNodeTemplateIDOfRelationshipTemplate(csarID,
- serviceTemplateID,
- relationshipTemplateID);
- }
- }
-
- final QName nodeTypeID =
- ServiceHandler.toscaEngineService.getNodeTypeOfNodeTemplate(csarID, serviceTemplateID, nodeTemplateID);
-
- ManagementBusInvocationPluginScript.LOG.debug("NodeType: {}", nodeTypeID);
-
- // Determine output parameters of the current operation
- final List outputParameters = new LinkedList<>();
- final boolean hasOutputParams =
- ServiceHandler.toscaEngineService.hasOperationOfATypeSpecifiedOutputParams(csarID, nodeTypeID,
- interfaceName, operationName);
- if (hasOutputParams) {
- final Node outputParametersNode =
- ServiceHandler.toscaEngineService.getOutputParametersOfATypeOperation(csarID, nodeTypeID, interfaceName,
- operationName);
- if (outputParametersNode != null) {
- final NodeList children = outputParametersNode.getChildNodes();
-
- for (int i = 0; i < children.getLength(); i++) {
- final Node child = children.item(i);
-
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- final String name = ((Element) child).getAttribute("name");
- outputParameters.add(name);
- }
- }
- }
- }
- for (final String param : outputParameters) {
- ManagementBusInvocationPluginScript.LOG.debug("Output parameter: {}", param);
- }
-
- final QName artifactType =
- ServiceHandler.toscaEngineService.getArtifactTypeOfArtifactTemplate(csarID, artifactTemplateID);
-
- ManagementBusInvocationPluginScript.LOG.debug("ArtifactType of ArtifactTemplate {} : {}", artifactTemplateID,
- artifactType);
-
- if (artifactType != null && nodeTemplateID != null) {
-
- // search operating system IA to upload files and run scripts on
- // target machine
- final Long serviceTemplateInstanceID =
- Long.parseLong(StringUtils.substringAfterLast(serviceInstanceID.toString(), "/"));
- final String osNodeTemplateID =
- MBUtils.getOperatingSystemNodeTemplateID(csarID, serviceTemplateID, nodeTemplateID, true,
- serviceTemplateInstanceID);
- if (osNodeTemplateID != null) {
- QName osNodeTypeID =
- ServiceHandler.toscaEngineService.getNodeTypeOfNodeTemplate(csarID, serviceTemplateID,
- osNodeTemplateID);
-
- if (osNodeTypeID.equals(Types.abstractOperatingSystemNodeType)) {
- final NodeTemplateInstance abstractOSInstance =
- MBUtils.getNodeTemplateInstance(serviceTemplateInstanceID, osNodeTemplateID);
- final NodeTemplateInstance nodeTemplateInstance =
- MBUtils.getAbstractOSReplacementInstance(abstractOSInstance);
- if (nodeTemplateInstance != null) {
- osNodeTypeID =
- ServiceHandler.toscaEngineService.getNodeTypeOfNodeTemplate(nodeTemplateInstance.getServiceTemplateInstance()
- .getCsarId(),
- nodeTemplateInstance.getServiceTemplateInstance()
- .getTemplateId(),
- nodeTemplateInstance.getTemplateId()
- .getLocalPart());
- tempNodeTemplateID = nodeTemplateInstance.getTemplateId().getLocalPart();
- tempCsarID = nodeTemplateInstance.getServiceTemplateInstance().getCsarId();
- tempServiceTemplateID = nodeTemplateInstance.getServiceTemplateInstance().getTemplateId();
-
- }
- }
- if (osNodeTypeID != null) {
- String osIAName = null;
- ManagementBusInvocationPluginScript.LOG.debug("OperatingSystem-NodeType found: {}", osNodeTypeID);
- final boolean abstractOSExists =
- Stream.of(tempNodeTemplateID, tempCsarID, tempServiceTemplateID).allMatch(x -> x != null);
- if (abstractOSExists) {
- osIAName = MBUtils.getOperatingSystemIA(tempCsarID, tempServiceTemplateID, tempNodeTemplateID);
- } else {
- osIAName = MBUtils.getOperatingSystemIA(csarID, serviceTemplateID, osNodeTemplateID);
- }
- if (osIAName != null) {
-
- final Object params = message.getBody();
-
- // create headers
- final HashMap headers = new HashMap<>();
-
- headers.put(MBHeader.CSARID.toString(), csarID);
- headers.put(MBHeader.SERVICETEMPLATEID_QNAME.toString(), serviceTemplateID);
- headers.put(MBHeader.NODETEMPLATEID_STRING.toString(), osNodeTemplateID);
- if (abstractOSExists) {
- headers.put(MBHeader.INTERFACENAME_STRING.toString(),
- MBUtils.getInterfaceForOperatingSystemNodeType(tempCsarID, osNodeTypeID));
- } else {
- headers.put(MBHeader.INTERFACENAME_STRING.toString(),
- MBUtils.getInterfaceForOperatingSystemNodeType(csarID, osNodeTypeID));
- }
- headers.put(MBHeader.SERVICEINSTANCEID_URI.toString(), serviceInstanceID);
- headers.put(MBHeader.NODEINSTANCEID_STRING.toString(), nodeInstanceID);
-
- // install packages
- ManagementBusInvocationPluginScript.LOG.debug("Installing packages...");
-
- installPackages(artifactType, headers);
-
- ManagementBusInvocationPluginScript.LOG.debug("Packages installed.");
-
- // get list of artifacts
- final List artifactReferences =
- ServiceHandler.toscaEngineService.getArtifactReferenceWithinArtifactTemplate(csarID,
- artifactTemplateID);
-
- ManagementBusInvocationPluginScript.LOG.debug("{} contains {} artifacts. Uploading and executing them...",
- artifactTemplateID, artifactReferences.size());
-
- // Map which contains the output parameters
- final Map resultMap = new HashMap<>();
-
- final String targetBasePath = "~/" + csarID.getFileName();
-
- // upload and execute all contained artifacts
- for (final String artifactRef : artifactReferences) {
-
- final String fileSource =
- Settings.CONTAINER_API + "/csars/" + csarID.getFileName() + "/content/" + artifactRef;
-
- final String targetFilePath = targetBasePath + "/" + artifactRef;
-
- final String targetFileFolderPath = FilenameUtils.getFullPathNoEndSeparator(targetFilePath);
-
- final String createDirCommand = "sleep 1 && mkdir -p " + targetFileFolderPath;
-
- ManagementBusInvocationPluginScript.LOG.debug("Uploading file: {}", fileSource);
-
- // create directory before uploading file
- runScript(createDirCommand, headers);
-
- // upload file
- transferFile(csarID, artifactTemplateID, fileSource, targetFilePath, headers);
-
- ManagementBusInvocationPluginScript.LOG.debug("File successfully uploaded.");
-
- // run script
- ManagementBusInvocationPluginScript.LOG.debug("Running script...");
-
- final String fileNameWithE = FilenameUtils.getName(targetFilePath);
- final String fileNameWithoutE = FilenameUtils.getBaseName(targetFilePath);
-
- String artifactTypeSpecificCommand =
- createArtifcatTypeSpecificCommandString(csarID, artifactType, artifactTemplateID,
- params);
-
- ManagementBusInvocationPluginScript.LOG.debug("Replacing further generic placeholder...");
-
- // replace placeholders
- artifactTypeSpecificCommand =
- artifactTypeSpecificCommand.replace(ManagementBusInvocationPluginScript.PLACEHOLDER_TARGET_FILE_PATH,
- targetFilePath);
- artifactTypeSpecificCommand =
- artifactTypeSpecificCommand.replace(ManagementBusInvocationPluginScript.PLACEHOLDER_TARGET_FILE_FOLDER_PATH,
- targetFileFolderPath);
- artifactTypeSpecificCommand =
- artifactTypeSpecificCommand.replace(ManagementBusInvocationPluginScript.PLACEHOLDER_TARGET_FILE_NAME_WITH_EXTENSION,
- fileNameWithE);
- artifactTypeSpecificCommand =
- artifactTypeSpecificCommand.replace(ManagementBusInvocationPluginScript.PLACEHOLDER_TARGET_FILE_NAME_WITHOUT_EXTENSION,
- fileNameWithoutE);
- artifactTypeSpecificCommand =
- artifactTypeSpecificCommand.replace(ManagementBusInvocationPluginScript.PLACEHOLDER_DA_NAME_PATH_MAP,
- createDANamePathMapEnvVar(csarID, serviceTemplateID,
- nodeTypeID,
- nodeTemplateID)
- + " CSAR='" + csarID + "' NodeInstanceID='"
- + nodeInstanceID + "' ServiceInstanceID='"
- + serviceInstanceID + "' ");
- artifactTypeSpecificCommand =
- artifactTypeSpecificCommand.replace(ManagementBusInvocationPluginScript.PLACEHOLDER_DA_INPUT_PARAMETER,
- createParamsString(params));
-
- if (!Boolean.valueOf(Settings.OPENTOSCA_ENGINE_IA_KEEPFILES)) {
- // delete the uploaded file on the remote site to save resources
- final String deleteFileCommand = "; rm -f " + targetFilePath;
- artifactTypeSpecificCommand = artifactTypeSpecificCommand + deleteFileCommand;
- }
-
- ManagementBusInvocationPluginScript.LOG.debug("Final command for the script execution: {}",
- artifactTypeSpecificCommand);
-
- final Object result = runScript(artifactTypeSpecificCommand, headers);
-
- ManagementBusInvocationPluginScript.LOG.debug("Script execution result: {}", result);
-
- // check for output parameters in the script result and add them to the
- // operation result
- addOutputParametersToResultMap(resultMap, result, outputParameters);
- }
-
- if (!Boolean.valueOf(Settings.OPENTOSCA_ENGINE_IA_KEEPFILES)) {
- // remove the created directories
- ManagementBusInvocationPluginScript.LOG.debug("Deleting directories...");
- final String deleteDirsCommand = "find " + targetBasePath + " -empty -type d -delete";
- runScript(deleteDirsCommand, headers);
- }
-
-
- ManagementBusInvocationPluginScript.LOG.debug("All artifacts are executed. Returning result to the Management Bus...");
-
- // create dummy response in case there are no output parameters
- if (resultMap.isEmpty()) {
- resultMap.put("invocation", "finished");
- }
-
- exchange.getIn().setBody(resultMap);
- } else {
- ManagementBusInvocationPluginScript.LOG.warn("No OperatingSystem-IA found!");
- }
- } else {
- ManagementBusInvocationPluginScript.LOG.warn("No OperatingSystem-NodeType found!");
- }
- } else {
- ManagementBusInvocationPluginScript.LOG.warn("No OperatingSystem-NodeTemplate found!");
- }
- } else {
- ManagementBusInvocationPluginScript.LOG.warn("Could not determine ArtifactType of ArtifactTemplate: {}!",
- artifactTemplateID);
- }
- return exchange;
- }
-
- /**
- * Check if the output parameters for this script service operation are returned in the script
- * result and add them to the result map.
- *
- * @param resultMap The result map which is returned for the invocation of the script service
- * operation
- * @param result The returned result of the run script operation
- * @param outputParameters The output parameters that are expected for the operation
- */
- private void addOutputParametersToResultMap(final Map resultMap, final Object result,
- final List outputParameters) {
-
- ManagementBusInvocationPluginScript.LOG.debug("Adding output parameters to the response message.");
-
- if (!outputParameters.isEmpty()) {
- // process result as HashMap
- if (result instanceof HashMap, ?>) {
- final HashMap, ?> resultHashMap = (HashMap, ?>) result;
-
- // get ScriptResult part of the response which contains the parameters
- if (resultHashMap.containsKey(ManagementBusInvocationPluginScript.RUN_SCRIPT_OUTPUT_PARAMETER_NAME)) {
- final Object scriptResult =
- resultHashMap.get(ManagementBusInvocationPluginScript.RUN_SCRIPT_OUTPUT_PARAMETER_NAME);
-
- if (scriptResult != null) {
- final String scriptResultString = scriptResult.toString();
-
- ManagementBusInvocationPluginScript.LOG.debug("{}: {}",
- ManagementBusInvocationPluginScript.RUN_SCRIPT_OUTPUT_PARAMETER_NAME,
- scriptResultString);
-
- // split result on line breaks as every parameter is returned in a separate
- // "echo" command
- final String[] resultParameters = scriptResultString.split("[\\r\\n]+");
-
- // add each parameter that is defined in the operation and passed back
- for (final String outputParameter : outputParameters) {
- for (int i = resultParameters.length - 1; i >= 0; i--) {
- if (resultParameters[i].startsWith(outputParameter)) {
- final String value =
- resultParameters[i].substring(resultParameters[i].indexOf("=") + 1);
-
- ManagementBusInvocationPluginScript.LOG.debug("Adding parameter {} with value: {}",
- outputParameter, value);
- resultMap.put(outputParameter, value);
- }
- }
- }
- }
-
- } else {
- ManagementBusInvocationPluginScript.LOG.warn("Result contains no result entry '{}'",
- ManagementBusInvocationPluginScript.RUN_SCRIPT_OUTPUT_PARAMETER_NAME);
- }
-
- } else {
- ManagementBusInvocationPluginScript.LOG.warn("Result of type {} not supported. The bus should return a HashMap as result class when it is used as input.",
- result.getClass());
- }
- }
- }
-
- /**
- * @param csarID
- * @param serviceTemplateID
- * @param nodeTypeID
- * @param nodeTemplateID
- *
- * @return mapping with DeploymentArtifact names and their paths.
- */
- private String createDANamePathMapEnvVar(final CSARID csarID, final QName serviceTemplateID, final QName nodeTypeID,
- final String nodeTemplateID) {
-
- ManagementBusInvocationPluginScript.LOG.debug("Checking if NodeTemplate {} has DAs...", nodeTemplateID);
-
- final HashMap> daNameReferenceMapping = new HashMap<>();
-
- final QName nodeTemplateQName = new QName(serviceTemplateID.getNamespaceURI(), nodeTemplateID);
-
- final ResolvedArtifacts resolvedArtifacts =
- ServiceHandler.toscaEngineService.getResolvedArtifactsOfNodeTemplate(csarID, nodeTemplateQName);
-
- final List resolvedDAs = resolvedArtifacts.getDeploymentArtifacts();
-
- List daArtifactReferences;
-
- for (final ResolvedDeploymentArtifact resolvedDA : resolvedDAs) {
-
- daArtifactReferences = resolvedDA.getReferences();
-
- for (final String daArtifactReference : daArtifactReferences) {
-
- ManagementBusInvocationPluginScript.LOG.debug("Artifact reference for DA: {} found: {} .",
- resolvedDA.getName(), daArtifactReference);
-
- List currentValue = daNameReferenceMapping.get(resolvedDA.getName());
- if (currentValue == null) {
- currentValue = new ArrayList<>();
- daNameReferenceMapping.put(resolvedDA.getName(), currentValue);
- }
- currentValue.add(daArtifactReference);
- }
- }
-
- final List nodeTypeImpls =
- ServiceHandler.toscaEngineService.getTypeImplementationsOfType(csarID, nodeTypeID);
-
- for (final QName nodeTypeImpl : nodeTypeImpls) {
- final List daNames =
- ServiceHandler.toscaEngineService.getDeploymentArtifactNamesOfNodeTypeImplementation(csarID,
- nodeTypeImpl);
-
- for (final String daName : daNames) {
- final QName daArtifactTemplate =
- ServiceHandler.toscaEngineService.getArtifactTemplateOfADeploymentArtifactOfANodeTypeImplementation(csarID,
- nodeTypeImpl,
- daName);
-
- daArtifactReferences =
- ServiceHandler.toscaEngineService.getArtifactReferenceWithinArtifactTemplate(csarID,
- daArtifactTemplate);
-
- for (final String daArtifactReference : daArtifactReferences) {
-
- ManagementBusInvocationPluginScript.LOG.debug("Artifact reference for DA: {} found: {} .", daName,
- daArtifactReference);
-
- List currentValue = daNameReferenceMapping.get(daName);
- if (currentValue == null) {
- currentValue = new ArrayList<>();
- daNameReferenceMapping.put(daName, currentValue);
- }
- currentValue.add(daArtifactReference);
- }
- }
- }
-
- String daEnvMap = "";
- if (!daNameReferenceMapping.isEmpty()) {
-
- ManagementBusInvocationPluginScript.LOG.debug("NodeTemplate {} has {} DAs.", nodeTemplateID,
- daNameReferenceMapping.size());
-
- daEnvMap += "DAs=\"";
- for (final Entry> da : daNameReferenceMapping.entrySet()) {
-
- final String daName = da.getKey();
- final List daRefs = da.getValue();
-
- for (String daRef : daRefs) {
-
- // FIXME / is a brutal assumption
- if (!daRef.startsWith("/")) {
- daRef = "/" + daRef;
- }
-
- daEnvMap += daName + "," + daRef + ";";
- }
- }
- daEnvMap += "\" ";
-
- ManagementBusInvocationPluginScript.LOG.debug("Created DA-DANamePathMapEnvVar for NodeTemplate {} : {}",
- nodeTemplateID, daEnvMap);
- }
-
- return daEnvMap;
- }
-
- /**
- *
- * Installs required and specified packages of the specified ArtifactType. Required packages are in
- * defined the corresponding *.xml file.
- *
- * @param artifactType
- * @param headers
- */
- private void installPackages(final QName artifactType, final HashMap headers) {
-
- final List requiredPackages = ArtifactTypesHandler.getRequiredPackages(artifactType);
-
- String requiredPackagesString = "";
-
- if (!requiredPackages.isEmpty()) {
-
- final HashMap inputParamsMap = new HashMap<>();
-
- for (final String requiredPackage : requiredPackages) {
- requiredPackagesString += requiredPackage;
- requiredPackagesString += " ";
- }
- inputParamsMap.put(Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_PARAMETER_PACKAGENAMES,
- requiredPackagesString);
-
- ManagementBusInvocationPluginScript.LOG.debug("Installing packages: {} for ArtifactType: {} ",
- requiredPackages, artifactType);
-
- headers.put(MBHeader.OPERATIONNAME_STRING.toString(),
- Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_INSTALLPACKAGE);
-
- invokeManagementBusEngine(inputParamsMap, headers);
- } else {
- ManagementBusInvocationPluginScript.LOG.debug("ArtifactType: {} needs no packages to install.",
- requiredPackages, artifactType);
- }
- }
-
- /**
- *
- * For transferring files to the target machine.
- *
- * @param csarID
- * @param artifactTemplate
- * @param source
- * @param target
- * @param headers
- */
- private void transferFile(final CSARID csarID, final QName artifactTemplate, final String source,
- final String target, final HashMap headers) {
-
- final HashMap inputParamsMap = new HashMap<>();
-
- inputParamsMap.put(Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_PARAMETER_TARGETABSOLUTPATH,
- target);
- inputParamsMap.put(Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_PARAMETER_SOURCEURLORLOCALPATH,
- source);
-
- ManagementBusInvocationPluginScript.LOG.debug("Uploading file. Source: {} Target: {} ", source, target);
-
- headers.put(MBHeader.OPERATIONNAME_STRING.toString(),
- Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_TRANSFERFILE);
-
- ManagementBusInvocationPluginScript.LOG.debug("Invoking ManagementBus for transferFile with the following headers:");
-
- for (final String key : headers.keySet()) {
- if (headers.get(key) != null && headers.get(key) instanceof String) {
- ManagementBusInvocationPluginScript.LOG.debug("Header: " + key + " Value: " + headers.get(key));
- }
- }
-
- invokeManagementBusEngine(inputParamsMap, headers);
-
- }
-
- /**
- *
- * For running scripts on the target machine. Commands to be executed are defined in the
- * corresponding *.xml file.
- *
- * @param commandsString
- * @param headers
- */
- private Object runScript(final String commandsString, final HashMap headers) {
-
- final HashMap inputParamsMap = new HashMap<>();
-
- inputParamsMap.put(Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_PARAMETER_SCRIPT, commandsString);
-
- ManagementBusInvocationPluginScript.LOG.debug("RunScript: {} ", commandsString);
-
- headers.put(MBHeader.OPERATIONNAME_STRING.toString(),
- Interfaces.OPENTOSCA_DECLARATIVE_INTERFACE_OPERATINGSYSTEM_RUNSCRIPT);
-
- ManagementBusInvocationPluginScript.LOG.debug("Invoking ManagementBus for runScript with the following headers:");
-
- for (final String key : headers.keySet()) {
- if (headers.get(key) != null && headers.get(key) instanceof String) {
- ManagementBusInvocationPluginScript.LOG.debug("Header: " + key + " Value: " + headers.get(key));
- }
- }
-
- return invokeManagementBusEngine(inputParamsMap, headers);
- }
-
- /**
- *
- * Creates ArtifactType specific commands that should be executed on the target machine. Commands to
- * be executed are defined in the corresponding *.xml file.
- *
- * @param csarID
- * @param artifactType
- * @param artifactTemplateID
- * @param params
- *
- * @return the created command
- */
- @SuppressWarnings("unchecked")
- private String createArtifcatTypeSpecificCommandString(final CSARID csarID, final QName artifactType,
- final QName artifactTemplateID, final Object params) {
-
- ManagementBusInvocationPluginScript.LOG.debug("Creating ArtifcatType specific command for artifactType {}:...",
- artifactType);
-
- String commandsString = "";
-
- final List commands = ArtifactTypesHandler.getCommands(artifactType);
-
- for (final String command : commands) {
- commandsString += command;
- commandsString += " && ";
- }
-
- if (commandsString.endsWith(" && ")) {
- commandsString = commandsString.substring(0, commandsString.length() - 4);
- }
-
- ManagementBusInvocationPluginScript.LOG.debug("Defined generic command for ArtifactType {} : {} ", artifactType,
- commandsString);
-
- // replace placeholder with data from inputParams and/or instance data
-
- if (commandsString.contains("{{") && commandsString.contains("}}")) {
-
- ManagementBusInvocationPluginScript.LOG.debug("Replacing the placeholder of the generic command with properties data and/or provided input parameter...");
-
- HashMap paramsMap = new HashMap<>();
-
- if (params instanceof HashMap) {
- paramsMap = (HashMap) params;
- } else if (params instanceof Document) {
- final Document paramsDoc = (Document) params;
- paramsMap = MBUtils.docToMap(paramsDoc, true);
- }
-
- final Document propDoc =
- ServiceHandler.toscaEngineService.getPropertiesOfAArtifactTemplate(csarID, artifactTemplateID);
-
- if (propDoc != null) {
- paramsMap.putAll(MBUtils.docToMap(propDoc, true));
- }
-
- for (final Entry prop : paramsMap.entrySet()) {
- commandsString = commandsString.replace("{{" + prop.getKey() + "}}", prop.getValue());
- }
-
- // delete not replaced placeholder
- commandsString = commandsString.replaceAll("\\{\\{.*?\\}\\}", "");
-
- ManagementBusInvocationPluginScript.LOG.debug("Generic command with replaced placeholder: {}",
- commandsString);
- }
-
- return commandsString;
- }
-
- /**
- * @param params
- * @return whitespace separated String with parameter keys and values
- */
- @SuppressWarnings("unchecked")
- private String createParamsString(final Object params) {
- HashMap paramsMap = new HashMap<>();
-
- if (params instanceof HashMap) {
- paramsMap = (HashMap) params;
- } else if (params instanceof Document) {
- final Document paramsDoc = (Document) params;
- paramsMap = MBUtils.docToMap(paramsDoc, true);
- }
-
- String paramsString = "";
- for (final Entry param : paramsMap.entrySet()) {
- // info:
- // https://stackoverflow.com/questions/3005963/how-can-i-have-a-newline-in-a-string-in-sh
- // https://stackoverflow.com/questions/1250079/how-to-escape-single-quotes-within-single-quoted-strings
- // we have to escape single quotes in the parameter values and properly pipe newlines
- // TODO(?) There is still the issue if you use commands in scipt which don't interpret
- // backslashes
- paramsString += param.getKey() + "=$'" + escapeSpecialCharacters(param.getValue()) + "' ";
- }
-
- return paramsString;
- }
-
- /**
- * Escapes special charactes inside the given string conforming to bash argument values.
- *
- * @see e.g.
- * https://stackoverflow.com/questions/1250079/how-to-escape-single-quotes-within-single-quoted-strings
- *
- * @return a String with escaped singles quotes
- */
- private String escapeSpecialCharacters(final String unenscapedString) {
- return unenscapedString.replace("'", "'\"'\"'").replace("\n", "'\"\\n\"'").replace("\t", "'\"\\t\"'")
- .replace(" ", "'\" \"'");
- }
-
- /**
- * Invokes the Management Bus.
- *
- * @param paramsMap
- * @param headers
- */
- private Object invokeManagementBusEngine(final HashMap paramsMap,
- final HashMap headers) {
-
- ManagementBusInvocationPluginScript.LOG.debug("Invoking the Management Bus...");
-
- final ProducerTemplate template = Activator.camelContext.createProducerTemplate();
-
- final Object response =
- template.requestBodyAndHeaders("bean:org.opentosca.bus.management.service.IManagementBusService?method=invokeIA",
- paramsMap, headers);
-
- ManagementBusInvocationPluginScript.LOG.debug("Invocation finished: {}", response);
-
- return response;
- }
-
- @Override
- public List getSupportedTypes() {
- return ArtifactTypesHandler.getSupportedTypes().stream().map(QName::toString).collect(Collectors.toList());
- }
-}
diff --git a/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/model/artifacttypes/ObjectFactory.java b/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/model/artifacttypes/ObjectFactory.java
deleted file mode 100644
index 5ee7aad5b..000000000
--- a/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/model/artifacttypes/ObjectFactory.java
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
-// Implementation, v2.2.4-2
-// See http://java.sun.com/xml/jaxb
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2016.07.12 at 02:53:01 PM CEST
-//
-
-
-package org.opentosca.bus.management.invocation.plugin.script.model.artifacttypes;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each Java content interface and Java element interface
- * generated in the org.opentosca.bus.management.invocation.plugin.script.model.artifacttypes
- * package.
- *
- * An ObjectFactory allows you to programatically construct new instances of the Java representation
- * for XML content. The Java representation of XML content can consist of schema derived interfaces
- * and classes representing the binding of schema type definitions, element declarations and model
- * groups. Factory methods for each of these are provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes
- * for package: org.opentosca.bus.management.plugins.remote.service.impl.artifacttypes
- *
- */
- public ObjectFactory() {}
-
- /**
- * Create an instance of {@link Artifacttype }
- *
- */
- public Artifacttype createArtifacttype() {
- return new Artifacttype();
- }
-
- /**
- * Create an instance of {@link Packagestype }
- *
- */
- public Packagestype createPackagestype() {
- return new Packagestype();
- }
-
- /**
- * Create an instance of {@link Commandstype }
- *
- */
- public Commandstype createCommandstype() {
- return new Commandstype();
- }
-
-}
diff --git a/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/servicehandler/ServiceHandler.java b/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/servicehandler/ServiceHandler.java
deleted file mode 100644
index 2ba713c4d..000000000
--- a/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/servicehandler/ServiceHandler.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.opentosca.bus.management.invocation.plugin.script.servicehandler;
-
-import org.opentosca.container.core.engine.IToscaEngineService;
-import org.opentosca.container.core.service.ICoreEndpointService;
-import org.opentosca.container.core.service.IInstanceDataService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Helper class that handles all needed services for ManagementBus-Script-Invocation-Plugin.
- *
- *
- *
- * In this class the from the ScriptPlugin needed services are binded an unbinded.
- *
- *
- * @see IManagementBusPluginService
- * @see IToscaEngineService
- * @see ICoreEndpointService
- *
- * @author Michael Zimmermann - michael.zimmermann@iaas.uni-stuttgart.de
- *
- */
-
-public class ServiceHandler {
-
- public static IInstanceDataService instanceDataService, oldInstanceDataService;
- public static IToscaEngineService toscaEngineService, oldToscaEngineService;
-
- private final static Logger LOG = LoggerFactory.getLogger(ServiceHandler.class);
-
-
- /**
- * Bind ToscaEngineService
- *
- * @param toscaEngineService
- */
- public void bindToscaService(final IToscaEngineService toscaEngineService) {
- if (toscaEngineService != null) {
- if (ServiceHandler.toscaEngineService == null) {
- ServiceHandler.toscaEngineService = toscaEngineService;
- } else {
- ServiceHandler.oldToscaEngineService = toscaEngineService;
- ServiceHandler.toscaEngineService = toscaEngineService;
- }
-
- ServiceHandler.LOG.debug("Bind ToscaEngineService: {} bound.", toscaEngineService.toString());
- } else {
- ServiceHandler.LOG.error("Bind ToscaEngineService: Supplied parameter is null!");
- }
- }
-
- /**
- * Unbind ToscaEngineService
- *
- * @param toscaEngineService
- */
- public void unbindToscaService(IToscaEngineService toscaEngineService) {
- if (ServiceHandler.oldToscaEngineService == null) {
- toscaEngineService = null;
- } else {
- ServiceHandler.oldToscaEngineService = null;
- }
-
- ServiceHandler.LOG.debug("ToscaEngineService unbound.");
- }
-
- /**
- * Bind InstanceDataService
- *
- * @param instanceDataService
- */
- public void bindInstanceDataService(final IInstanceDataService instanceDataService) {
- if (instanceDataService != null) {
- if (ServiceHandler.instanceDataService == null) {
- ServiceHandler.instanceDataService = instanceDataService;
- } else {
- ServiceHandler.oldInstanceDataService = instanceDataService;
- ServiceHandler.instanceDataService = instanceDataService;
- }
-
- ServiceHandler.LOG.debug("Bind InstanceDataServiceInterface: {} bound.",
- ServiceHandler.instanceDataService.toString());
- } else {
- ServiceHandler.LOG.error("Bind InstanceDataServiceInterface: Supplied parameter is null!");
- }
- }
-
- /**
- * Unbind InstanceDataServiceInterface
- *
- * @param instanceDataService
- */
- public void unbindInstanceDataService(IInstanceDataService instanceDataService) {
- if (ServiceHandler.oldInstanceDataService == null) {
- instanceDataService = null;
- } else {
- ServiceHandler.oldInstanceDataService = null;
- }
-
- ServiceHandler.LOG.debug("InstanceDataServiceInterface unbound.");
- }
-
-}
diff --git a/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/typeshandler/ArtifactTypesHandler.java b/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/typeshandler/ArtifactTypesHandler.java
deleted file mode 100644
index 52ae0abfb..000000000
--- a/org.opentosca.bus.management.invocation.plugin.script/src/org/opentosca/bus/management/invocation/plugin/script/typeshandler/ArtifactTypesHandler.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.opentosca.bus.management.invocation.plugin.script.typeshandler;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.opentosca.bus.management.invocation.plugin.script.model.artifacttypes.Artifacttype;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Handles the config files (located in artifacttypes folder) for the different supported
- * ArtifactTypes.
- *
- *
- * @author Michael Zimmermann - michael.zimmermann@iaas.uni-stuttgart.de
- *
- */
-public class ArtifactTypesHandler {
-
- private static final String ARTIFACT_TYPES_DEFINTION_FOLDER = "/META-INF/artifacttypes";
-
- final private static Logger LOG = LoggerFactory.getLogger(ArtifactTypesHandler.class);
-
- private static HashMap artifact_types = new HashMap<>();
-
- /**
- * Initially reads all ArtifactTypes config files.
- *
- * @param bundleContext
- */
- public static void init(final BundleContext bundleContext) {
-
- ArtifactTypesHandler.LOG.debug("Registering the supported ArtifactTypes...");
-
- File[] types_definitions_files = null;
-
- URL bundleResURL = null;
- URL fileResURL = null;
- File typesFolder = null;
-
- try {
- bundleResURL = bundleContext.getBundle().getEntry(ARTIFACT_TYPES_DEFINTION_FOLDER);
- // convert bundle resource URL to file URL
- fileResURL = FileLocator.toFileURL(bundleResURL);
- typesFolder = new File(fileResURL.getPath());
- }
- catch (final IOException e) {
- ArtifactTypesHandler.LOG.error("", e);
- }
-
- if (typesFolder == null) {
- ArtifactTypesHandler.LOG.error("Can't get ArtifactTypes configuration files.");
- }
-
- if (typesFolder != null && typesFolder.isDirectory()) {
- types_definitions_files = typesFolder.listFiles((FileFilter) pathname -> {
- final String name = pathname.getName().toLowerCase();
- return name.endsWith(".xml") && pathname.isFile();
- });
- }
-
- if (types_definitions_files != null) {
-
- for (final File type_defintion_file : types_definitions_files) {
-
- JAXBContext jaxbContext;
-
- try {
-
- jaxbContext = JAXBContext.newInstance(Artifacttype.class);
- final Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
- final Artifacttype artitacttype = (Artifacttype) jaxbUnmarshaller.unmarshal(type_defintion_file);
-
- final String artifactTypeName = artitacttype.getName();
- final String artifactTypeNamespace = artitacttype.getNamespace();
-
- final QName artifactType = new QName(artifactTypeNamespace, artifactTypeName);
-
- ArtifactTypesHandler.LOG.debug("Supported ArtifactType found: {}", artifactType);
-
- artifact_types.put(artifactType, artitacttype);
-
- }
- catch (final JAXBException e) {
- e.printStackTrace();
- }
- }
- } else {
- ArtifactTypesHandler.LOG.debug("No supported ArtifactTypes found.");
- }
- }
-
- /**
- * Returns the required packages of the specified ArtifactType.
- *
- * @param artifactType
- * @return the required packages of the specified ArtifactType.
- */
- public static List getRequiredPackages(final QName artifactType) {
-
- List requiredPackages = new ArrayList<>();
-
- if (artifact_types.containsKey(artifactType)) {
- requiredPackages = artifact_types.get(artifactType).getPackages().getPackage();
- } else {
- ArtifactTypesHandler.LOG.warn("ArtifactType: {} is not supported!", artifactType);
- }
-
- ArtifactTypesHandler.LOG.debug("Required packages of artifactType: {} : {}", artifactType, requiredPackages);
-
- return requiredPackages;
- }
-
- /**
- * Returns the defined commands of the specified ArtifactType.
- *
- * @param artifactType
- * @return the defined commands of the specified ArtifactType.
- */
- public static List getCommands(final QName artifactType) {
-
- List commands = new ArrayList<>();
-
- if (artifact_types.containsKey(artifactType)) {
- commands = artifact_types.get(artifactType).getCommands().getCommand();
- } else {
- ArtifactTypesHandler.LOG.warn("ArtifactType: {} is not supported!", artifactType);
- }
-
- ArtifactTypesHandler.LOG.debug("Commands to run for artifactType: {} : {}", artifactType, commands);
-
- return commands;
- }
-
- /**
- * @return the supported Types of the plugin. Based on the available *.xml files.
- */
- public static List getSupportedTypes() {
-
- final ArrayList