From f5f13c4f6b6fe3b4d98e349dfd7db59339803436 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 19 Feb 2017 12:35:04 +0200 Subject: push addional code Change-Id: Ia427bb3460cda3a896f8faced2de69eaf3807b74 Signed-off-by: Michael Lando --- .../openecomp-sdc-translator-api/pom.xml | 43 +++++++++++++++++++ .../core/translator/api/HeatToToscaTranslator.java | 48 ++++++++++++++++++++++ .../translator/datatypes/TranslatorOutput.java | 48 ++++++++++++++++++++++ .../factory/HeatToToscaTranslatorFactory.java | 33 +++++++++++++++ .../src/main/resources/factoryConfiguration.json | 3 ++ 5 files changed, 175 insertions(+) create mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml create mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/api/HeatToToscaTranslator.java create mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/datatypes/TranslatorOutput.java create mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/factory/HeatToToscaTranslatorFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/resources/factoryConfiguration.json (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api') diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml new file mode 100644 index 0000000000..e6eca41134 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + + + org.openecomp.sdc + openecomp-sdc-lib + 1.0.0-SNAPSHOT + ../.. + + + openecomp-sdc-translator-api + openecomp-sdc-translator-api + + + + org.openecomp.core + openecomp-facade-core + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-validation-api + ${project.version} + + + io.swagger + swagger-annotations + 1.5.3 + + + org.openecomp.core + openecomp-heat-lib + ${project.version} + + + org.openecomp.core + openecomp-tosca-lib + ${project.version} + + + + \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/api/HeatToToscaTranslator.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/api/HeatToToscaTranslator.java new file mode 100644 index 0000000000..62c098d146 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/api/HeatToToscaTranslator.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * 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========================================================= + */ + +package org.openecomp.core.translator.api; + +import org.openecomp.core.translator.datatypes.TranslatorOutput; +import org.openecomp.sdc.datatypes.error.ErrorMessage; + +import java.io.InputStream; +import java.util.List; +import java.util.Map; + +public interface HeatToToscaTranslator { + + void addManifest(String name, byte[] content); + + void addFile(String name, byte[] content); + + void addFile(String name, InputStream content); + + // return Map, key - file name which has error + // value - the error code + Map> validate(); + + TranslatorOutput translate(); + + void addExternalArtifacts(String name, byte[] content); + + void addExternalArtifacts(String name, InputStream content); + +} diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/datatypes/TranslatorOutput.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/datatypes/TranslatorOutput.java new file mode 100644 index 0000000000..ec36625ced --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/datatypes/TranslatorOutput.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * 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========================================================= + */ + +package org.openecomp.core.translator.datatypes; + +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; + +import java.util.List; +import java.util.Map; + +public class TranslatorOutput { + private Map> errorMessages; + private ToscaServiceModel toscaServiceModel; + + public Map> getErrorMessages() { + return errorMessages; + } + + public void setErrorMessages(Map> errorMessages) { + this.errorMessages = errorMessages; + } + + public ToscaServiceModel getToscaServiceModel() { + return toscaServiceModel; + } + + public void setToscaServiceModel(ToscaServiceModel toscaServiceModel) { + this.toscaServiceModel = toscaServiceModel; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/factory/HeatToToscaTranslatorFactory.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/factory/HeatToToscaTranslatorFactory.java new file mode 100644 index 0000000000..b9234cd87a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/java/org/openecomp/core/translator/factory/HeatToToscaTranslatorFactory.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * 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========================================================= + */ + +package org.openecomp.core.translator.factory; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; +import org.openecomp.core.translator.api.HeatToToscaTranslator; + +public abstract class HeatToToscaTranslatorFactory + extends AbstractComponentFactory { + + public static HeatToToscaTranslatorFactory getInstance() { + return AbstractFactory.getInstance(HeatToToscaTranslatorFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/resources/factoryConfiguration.json new file mode 100644 index 0000000000..4e4e2c23f9 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/src/main/resources/factoryConfiguration.json @@ -0,0 +1,3 @@ +{ + "org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory": "org.openecomp.sdc.translator.impl.heattotosca.HeatToToscaTranslatorFactoryImpl" +} \ No newline at end of file -- cgit 1.2.3-korg