From 9a98a583855c9665c7171ca2e44e311095cdaac1 Mon Sep 17 00:00:00 2001 From: lj1412 Date: Tue, 14 Feb 2017 15:11:24 +0000 Subject: Init ncomp.docker Change-Id: Ic87bcf77cff63ef6cd3004fbff9a69f11930d684 Signed-off-by: lj1412 --- .../ncomp/servers/docker/DockerDockerHost.java | 378 +++++++++++++++++++++ 1 file changed, 378 insertions(+) create mode 100644 ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java (limited to 'ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java') diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java new file mode 100644 index 0000000..d16b4ff --- /dev/null +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java @@ -0,0 +1,378 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + */ + +// Autogenerated +// Do not edit. No need to extend this class. +package org.openecomp.ncomp.servers.docker; + +import java.io.InputStream; +import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; +import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.function.FunctionUtils; +import org.openecomp.ncomp.component.ApiRequestStatus; + +import org.apache.log4j.Logger; +import org.eclipse.emf.common.util.EList; +import org.json.JSONObject; +import java.util.Date; + + + +import org.openecomp.ncomp.docker.impl.DockerHostImpl; + + + +public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { + public static final Logger logger = Logger.getLogger(DockerDockerHost.class); + DockerDockerHostProvider controller; + ISiriusServer server; + + public DockerDockerHost(ISiriusServer server) { + this.server = server; + this.controller = new DockerDockerHostProvider(server,this); + } + + public void poll() { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "poll", ApiRequestStatus.START, duration_); + Date now_ = new Date(); + try { + controller.poll(); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "poll", ApiRequestStatus.ERROR, duration_); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "poll", ApiRequestStatus.OKAY, duration_); + + } + + public void startContainer(java.lang.String name) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "startContainer", ApiRequestStatus.START, duration_,name); + Date now_ = new Date(); + try { + controller.startContainer(name); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "startContainer", ApiRequestStatus.ERROR, duration_,name); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "startContainer", ApiRequestStatus.OKAY, duration_,name); + + } + + public void stopContainer(java.lang.String name, int seconds) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "stopContainer", ApiRequestStatus.START, duration_,name,seconds); + Date now_ = new Date(); + try { + controller.stopContainer(name,seconds); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "stopContainer", ApiRequestStatus.ERROR, duration_,name,seconds); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "stopContainer", ApiRequestStatus.OKAY, duration_,name,seconds); + + } + + public void restartContainer(java.lang.String name, int seconds) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "restartContainer", ApiRequestStatus.START, duration_,name,seconds); + Date now_ = new Date(); + try { + controller.restartContainer(name,seconds); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "restartContainer", ApiRequestStatus.ERROR, duration_,name,seconds); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "restartContainer", ApiRequestStatus.OKAY, duration_,name,seconds); + + } + + public void pauseContainer(java.lang.String name) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "pauseContainer", ApiRequestStatus.START, duration_,name); + Date now_ = new Date(); + try { + controller.pauseContainer(name); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "pauseContainer", ApiRequestStatus.ERROR, duration_,name); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "pauseContainer", ApiRequestStatus.OKAY, duration_,name); + + } + + public void unpauseContainer(java.lang.String name) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "unpauseContainer", ApiRequestStatus.START, duration_,name); + Date now_ = new Date(); + try { + controller.unpauseContainer(name); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "unpauseContainer", ApiRequestStatus.ERROR, duration_,name); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "unpauseContainer", ApiRequestStatus.OKAY, duration_,name); + + } + + public void removeContainer(java.lang.String name, boolean remove, boolean force) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "removeContainer", ApiRequestStatus.START, duration_,name,remove,force); + Date now_ = new Date(); + try { + controller.removeContainer(name,remove,force); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "removeContainer", ApiRequestStatus.ERROR, duration_,name,remove,force); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "removeContainer", ApiRequestStatus.OKAY, duration_,name,remove,force); + + } + + public void inspectContainer(java.lang.String name) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "inspectContainer", ApiRequestStatus.START, duration_,name); + Date now_ = new Date(); + try { + controller.inspectContainer(name); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "inspectContainer", ApiRequestStatus.ERROR, duration_,name); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "inspectContainer", ApiRequestStatus.OKAY, duration_,name); + + } + + public void killContainer(java.lang.String name, java.lang.String sigint) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "killContainer", ApiRequestStatus.START, duration_,name,sigint); + Date now_ = new Date(); + try { + controller.killContainer(name,sigint); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "killContainer", ApiRequestStatus.ERROR, duration_,name,sigint); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "killContainer", ApiRequestStatus.OKAY, duration_,name,sigint); + + } + + public void dockerRun(java.lang.String image) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "dockerRun", ApiRequestStatus.START, duration_,image); + Date now_ = new Date(); + try { + controller.dockerRun(image); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "dockerRun", ApiRequestStatus.ERROR, duration_,image); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "dockerRun", ApiRequestStatus.OKAY, duration_,image); + + } + + public void dockerRunWithName(java.lang.String image, java.lang.String name) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "dockerRunWithName", ApiRequestStatus.START, duration_,image,name); + Date now_ = new Date(); + try { + controller.dockerRunWithName(image,name); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "dockerRunWithName", ApiRequestStatus.ERROR, duration_,image,name); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "dockerRunWithName", ApiRequestStatus.OKAY, duration_,image,name); + + } + + public void dockerRunWithOptions(java.lang.String image, org.openecomp.ncomp.docker.ContainerOptions opts) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "dockerRunWithOptions", ApiRequestStatus.START, duration_,image,opts); + Date now_ = new Date(); + try { + controller.dockerRunWithOptions(image,opts); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "dockerRunWithOptions", ApiRequestStatus.ERROR, duration_,image,opts); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "dockerRunWithOptions", ApiRequestStatus.OKAY, duration_,image,opts); + + } + + public void containerStats(java.lang.String name, boolean stream) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "containerStats", ApiRequestStatus.START, duration_,name,stream); + Date now_ = new Date(); + try { + controller.containerStats(name,stream); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "containerStats", ApiRequestStatus.ERROR, duration_,name,stream); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "containerStats", ApiRequestStatus.OKAY, duration_,name,stream); + + } + + public void containerProcesses(java.lang.String name) { + + long duration_ = 0; + if (server != null) + server.getServer().recordApi(null, this, "containerProcesses", ApiRequestStatus.START, duration_,name); + Date now_ = new Date(); + try { + controller.containerProcesses(name); + } + catch (Exception e) { + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "containerProcesses", ApiRequestStatus.ERROR, duration_,name); + System.err.println("ERROR: " + e); + throw e; + } + duration_ = new Date().getTime()-now_.getTime(); + if (server != null) + server.getServer().recordApi(null, this, "containerProcesses", ApiRequestStatus.OKAY, duration_,name); + + } + + + + + + + @Override + public void start() { + controller.start(); + } + + public static void ecoreSetup() { + DockerDockerHostProvider.ecoreSetup(); + } + public DockerDockerHostProvider getSomfProvider() { + return controller; + } +} -- cgit 1.2.3-korg