aboutsummaryrefslogtreecommitdiffstats
path: root/jython-tosca-parser/src/main/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'jython-tosca-parser/src/main/java/org/openecomp')
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/JythonRuntime.java53
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/ToscaParser.java36
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/ToscaParserFactory.java48
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Capability.java38
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java75
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java32
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java28
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java32
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Property.java48
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/StatefulEntityTypeFactory.java28
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java67
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java75
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java63
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplateFactory.java14
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/GroupType.java30
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java27
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/StatefulEntityType.java31
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java47
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyCapability.java9
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyEntityTemplate.java16
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java10
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java9
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyProperty.java11
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java16
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java16
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java14
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyGroupType.java7
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyNodeType.java8
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyStatefulEntityType.java7
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java10
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/JarExtractor.java87
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/PythonType.java47
-rw-r--r--jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/PythonUtils.java13
33 files changed, 0 insertions, 1052 deletions
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/JythonRuntime.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/JythonRuntime.java
deleted file mode 100644
index c5810a9..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/JythonRuntime.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.openecomp.sdc.toscaparser;
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.Properties;
-
-import org.openecomp.sdc.toscaparser.utils.JarExtractor;
-import org.python.util.PythonInterpreter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JythonRuntime {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(JythonRuntime.class);
- private final JarExtractor jarExtractor;
- private Path homePath;
-
- public JythonRuntime(JarExtractor jarExtractor) {
- this.jarExtractor = jarExtractor;
- }
-
- public void initialize() throws IOException {
- tryExtractPyhtonPackages();
- initRuntime();
- }
-
- private void initRuntime() {
- Properties systemProperties = System.getProperties();
- Properties properties = getPythonProperties();
- PythonInterpreter.initialize(systemProperties, properties, new String[0]);
- }
-
- private void tryExtractPyhtonPackages() throws IOException {
- homePath = jarExtractor.extractPyhtonPackages();
- }
-
- private Properties getPythonProperties() {
- Properties properties = new Properties();
- if (homePath != null) {
- LOGGER.debug("getPythonProperties - Setting python.home to {}", homePath);
- properties.put("python.home", homePath.toString());
- }
- // Used to prevent: console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0.
- properties.put("python.console.encoding", "UTF-8");
- return properties;
- }
-
- public void terminate() throws IOException {
- if (homePath != null) {
- jarExtractor.deleteDirectory(homePath);
- }
- }
-} \ No newline at end of file
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/ToscaParser.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/ToscaParser.java
deleted file mode 100644
index ae595f1..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/ToscaParser.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.openecomp.sdc.toscaparser;
-
-import java.util.Objects;
-
-import org.openecomp.sdc.toscaparser.api.ToscaTemplate;
-import org.openecomp.sdc.toscaparser.api.ToscaTemplateFactory;
-import org.openecomp.sdc.toscaparser.jython.JyToscaTemplate;
-import org.python.core.PyObject;
-import org.python.core.PyString;
-import org.python.util.PythonInterpreter;
-
-public class ToscaParser {
-
- private final ToscaTemplateFactory toscaTemplateFactory;
- private final PyObject jythonToscaTemplate;
- private final PythonInterpreter pythonInterpreter;
-
- public ToscaParser(ToscaTemplateFactory toscaTemplateFactory, PythonInterpreter pythonInterpreter) {
- this.toscaTemplateFactory = Objects.requireNonNull(toscaTemplateFactory);
- this.pythonInterpreter = Objects.requireNonNull(pythonInterpreter);
- jythonToscaTemplate = getJythonToscaTemplate();
- }
-
- private PyObject getJythonToscaTemplate() {
- try (PythonInterpreter interpreter = pythonInterpreter) {
- interpreter.exec("from toscaparser.tosca_template import ToscaTemplate");
- return interpreter.get("ToscaTemplate");
- }
- }
-
- public ToscaTemplate parse(String path) {
- PyObject toscaTemplateInstance = jythonToscaTemplate.__call__(new PyString(path));
- JyToscaTemplate jyToscaTemplate = (JyToscaTemplate) toscaTemplateInstance.__tojava__(JyToscaTemplate.class);
- return toscaTemplateFactory.create(jyToscaTemplate);
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/ToscaParserFactory.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/ToscaParserFactory.java
deleted file mode 100644
index 8bb1e17..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/ToscaParserFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.openecomp.sdc.toscaparser;
-
-import java.io.IOException;
-
-import org.openecomp.sdc.toscaparser.api.ToscaTemplateFactory;
-import org.openecomp.sdc.toscaparser.utils.JarExtractor;
-import org.python.util.PythonInterpreter;
-
-/**
- * This is the entry point of the tosca-parser: a factory for creating {@code ToscaParser}s.
- * <b>This class is not thread-safe.</b> Once you are done with all {@code ToscaParser}s
- * created by this factory, the {@code ToscaParserFactory} itself must be closed either by
- * calling its close() method explicitly or preferrably by creating it in a try-with-resources block:
- * <pre>
- try (ToscaParserFactory toscaParserFactory = new ToscaParserFactory()){
- ToscaParser parser = toscaParserFactory.create()
- ToscaTemplate toscaTemplate = parser.parse(toscaFilePath);
- ...
- }
- * </pre>
- * @author Yaniv Nahoum
- *
- */
-public class ToscaParserFactory implements AutoCloseable {
-
- private JythonRuntime jythonRuntime;
-
- public ToscaParser create() throws IOException {
- initRuntime();
- ToscaTemplateFactory toscaTemplateFactory = new ToscaTemplateFactory();
- PythonInterpreter pythonInterpreter = new PythonInterpreter();
- return new ToscaParser(toscaTemplateFactory, pythonInterpreter);
- }
-
- private void initRuntime() throws IOException {
- if (jythonRuntime == null) {
- jythonRuntime = new JythonRuntime(new JarExtractor());
- jythonRuntime.initialize();
- }
- }
-
- @Override
- public void close() throws IOException {
- if (jythonRuntime != null) {
- jythonRuntime.terminate();
- }
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Capability.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Capability.java
deleted file mode 100644
index 1359c36..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Capability.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import static com.google.common.collect.ImmutableList.toImmutableList;
-
-import java.util.List;
-import java.util.Objects;
-
-import org.openecomp.sdc.toscaparser.jython.JyCapability;
-
-import com.google.common.base.MoreObjects;
-
-public class Capability {
-
- private final JyCapability jyCapability;
-
- public Capability(JyCapability jyCapability) {
- this.jyCapability = Objects.requireNonNull(jyCapability);
- }
-
- public String getName() {
- return jyCapability.getJyName();
- }
-
- public List<Property> getProperties() {
- return jyCapability.getJyProperties()
- .stream()
- .map(Property::new)
- .collect(toImmutableList());
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("name", getName())
- .add("properties", getProperties())
- .toString();
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
deleted file mode 100644
index 5a928e0..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/EntityTemplate.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import static com.google.common.collect.ImmutableList.toImmutableList;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import org.openecomp.sdc.toscaparser.api.elements.StatefulEntityType;
-import org.openecomp.sdc.toscaparser.jython.JyCapability;
-import org.openecomp.sdc.toscaparser.jython.JyEntityTemplate;
-import org.openecomp.sdc.toscaparser.jython.JyProperty;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.MoreObjects.ToStringHelper;
-
-public abstract class EntityTemplate {
-
- private final JyEntityTemplate jyEntityTemplate;
- private final StatefulEntityType statefulEntityType;
-
- public EntityTemplate(JyEntityTemplate jyEntityTemplate) {
- this.jyEntityTemplate = Objects.requireNonNull(jyEntityTemplate);
- StatefulEntityTypeFactory statefulEntityTypeFactory = new StatefulEntityTypeFactory();
- statefulEntityType = statefulEntityTypeFactory.create(jyEntityTemplate.getJyTypeDefinition());
- }
-
- public String getName() {
- return jyEntityTemplate.getJyName();
- }
-
- public String getDescription() {
- return jyEntityTemplate.getJyDescription();
- }
-
- public StatefulEntityType getTypeDefinition() {
- return statefulEntityType;
- }
-
- public List<Property> getProperties() {
- List<JyProperty> jyProperties = jyEntityTemplate.getJyProperties();
- return jyProperties != null ? jyProperties
- .stream()
- .map(Property::new)
- .collect(toImmutableList()) : new ArrayList<>();
- }
-
- public List<Capability> getCapabilities() {
- List<JyCapability> jyCapabilities = jyEntityTemplate.getJyCapabilities();
- return jyCapabilities != null ? jyCapabilities
- .stream()
- .map(Capability::new)
- .collect(toImmutableList()) : new ArrayList<>();
- }
-
- public List<Map<String, Map<String, Object>>> getRequirements() {
- return jyEntityTemplate.getJyRequirements();
- }
-
- protected ToStringHelper toStringHelper() {
- return MoreObjects.toStringHelper(this)
- .add("name", getName())
- .add("description", getDescription())
- .add("typeDefinition", getTypeDefinition())
- .add("properties", getProperties())
- .add("capabilities", getCapabilities())
- .add("requirements", getRequirements());
- }
-
- @Override
- public String toString() {
- return toStringHelper().toString();
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java
deleted file mode 100644
index 0fa0d9c..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Group.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import java.util.List;
-
-import org.openecomp.sdc.toscaparser.jython.JyGroup;
-
-import com.google.common.base.MoreObjects.ToStringHelper;
-
-public class Group extends EntityTemplate {
-
- private final JyGroup jyGroup;
-
- public Group(JyGroup jyGroup) {
- super(jyGroup);
- this.jyGroup = jyGroup;
- }
-
- public List<String> getMembers(){
- return jyGroup.getJyMembers();
- }
-
- public Metadata getMetadata(){
- return jyGroup.getJyMetadata() != null ? new Metadata(jyGroup.getJyMetadata()) : null;
- }
-
- @Override
- protected ToStringHelper toStringHelper() {
- return super.toStringHelper()
- .add("members", getMembers())
- .add("metadata", getMetadata());
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java
deleted file mode 100644
index 4fa3646..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Metadata.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import java.util.Map;
-
-import com.google.common.base.MoreObjects;
-
-public class Metadata {
-
- private final Map<String, Object> metadataMap;
-
- public Metadata(Map<String, Object> metadataMap) {
- this.metadataMap = metadataMap;
- }
-
- public String getValue(String key) {
- return !isEmpty() ? String.valueOf(this.metadataMap.get(key)) : null;
- }
-
- private boolean isEmpty() {
- return this.metadataMap == null || this.metadataMap.size() == 0;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("metadataMap", metadataMap).toString();
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java
deleted file mode 100644
index 3592a69..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/NodeTemplate.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import org.openecomp.sdc.toscaparser.jython.JyNodeTemplate;
-import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings;
-
-import com.google.common.base.MoreObjects.ToStringHelper;
-
-public class NodeTemplate extends EntityTemplate {
-
- private final JyNodeTemplate jyNodeTemplate;
-
- public NodeTemplate(JyNodeTemplate jyNodeTemplate) {
- super(jyNodeTemplate);
- this.jyNodeTemplate = jyNodeTemplate;
- }
-
- public Metadata getMetadata() {
- return jyNodeTemplate.getJyMetadata() != null ? new Metadata(jyNodeTemplate.getJyMetadata()) : null;
- }
-
- public SubstitutionMappings getSubstitutionMappings(){
- JySubstitutionMappings jySubstitutionMappings = jyNodeTemplate.getJySubstitutionMappings();
- return jySubstitutionMappings != null ? new SubstitutionMappings(jySubstitutionMappings) : null;
- }
-
- @Override
- protected ToStringHelper toStringHelper() {
- return super.toStringHelper()
- .add("metadata", getMetadata())
- .add("substitutionMappings", getSubstitutionMappings());
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Property.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Property.java
deleted file mode 100644
index c52efb6..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/Property.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import java.util.Objects;
-
-import org.openecomp.sdc.toscaparser.jython.JyProperty;
-import org.openecomp.sdc.toscaparser.utils.PythonUtils;
-
-import com.google.common.base.MoreObjects;
-
-public class Property {
-
- private final JyProperty jyProperty;
-
- public Property(JyProperty jyProperty) {
- this.jyProperty = Objects.requireNonNull(jyProperty);
- }
-
- public String getName() {
- return jyProperty.getJyName();
- }
-
- public Object getValue() {
- return PythonUtils.cast(jyProperty.getJyValue(), jyProperty.getJyValueClassName());
- }
-
- public String getType() {
- return jyProperty.getJyType();
- }
-
- public boolean isRequired() {
- return jyProperty.isJyRequired();
- }
-
- public String getDescription() {
- return jyProperty.getJyDescription();
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("name", getName())
- .add("type", getType())
- .add("required", isRequired())
- .add("description", getDescription())
- .add("value", getValue())
- .toString();
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/StatefulEntityTypeFactory.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/StatefulEntityTypeFactory.java
deleted file mode 100644
index 554450a..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/StatefulEntityTypeFactory.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import org.openecomp.sdc.toscaparser.api.elements.GroupType;
-import org.openecomp.sdc.toscaparser.api.elements.NodeType;
-import org.openecomp.sdc.toscaparser.api.elements.StatefulEntityType;
-import org.openecomp.sdc.toscaparser.jython.elements.JyGroupType;
-import org.openecomp.sdc.toscaparser.jython.elements.JyNodeType;
-import org.openecomp.sdc.toscaparser.jython.elements.JyStatefulEntityType;
-
-public class StatefulEntityTypeFactory {
-
- public StatefulEntityType create(JyStatefulEntityType jyStatefulEntityType) {
- String jyClassName = jyStatefulEntityType.getJyClassName();
- StatefulEntityType statefulEntityType;
- switch (jyClassName) {
- case "NodeType":
- statefulEntityType = new NodeType((JyNodeType) jyStatefulEntityType);
- break;
- case "GroupType":
- statefulEntityType = new GroupType((JyGroupType) jyStatefulEntityType);
- break;
- default:
- throw new UnsupportedOperationException(jyClassName + " is not supported!");
- }
-
- return statefulEntityType;
- }
-} \ No newline at end of file
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java
deleted file mode 100644
index e962a4a..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/SubstitutionMappings.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import static com.google.common.collect.ImmutableList.toImmutableList;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-import org.openecomp.sdc.toscaparser.api.elements.NodeType;
-import org.openecomp.sdc.toscaparser.api.parameters.Input;
-import org.openecomp.sdc.toscaparser.jython.JyGroup;
-import org.openecomp.sdc.toscaparser.jython.JyNodeTemplate;
-import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings;
-import org.openecomp.sdc.toscaparser.jython.parameters.JyInput;
-
-import com.google.common.base.MoreObjects;
-
-public class SubstitutionMappings {
-
- private final JySubstitutionMappings jySubstitutionMappings;
-
- public SubstitutionMappings(JySubstitutionMappings jySubstitutionMappings) {
- this.jySubstitutionMappings = Objects.requireNonNull(jySubstitutionMappings);
- }
-
- public List<NodeTemplate> getNodeTemplates() {
- List<JyNodeTemplate> jyNodeTemplates = jySubstitutionMappings.getJyNodeTemplates();
- return jyNodeTemplates != null ? jyNodeTemplates
- .stream()
- .map(NodeTemplate::new)
- .collect(toImmutableList()) : new ArrayList<>();
- }
-
- public List<Group> getGroups() {
- List<JyGroup> jyGroups = jySubstitutionMappings.getJyGroups();
- return jyGroups != null ? jyGroups
- .stream()
- .map(Group::new)
- .collect(toImmutableList()) : new ArrayList<>();
- }
-
- public List<Input> getInputs() {
- List<JyInput> jyInputs = jySubstitutionMappings.getJyInputs();
- return jyInputs != null ? jyInputs
- .stream()
- .map(Input::new)
- .collect(toImmutableList()) : new ArrayList<>();
- }
-
- public NodeType getNodeDefinition() {
- return new NodeType(jySubstitutionMappings.getJyNodeDefinition());
- }
-
- public Metadata getMetadata(){
- return jySubstitutionMappings.getJyMetadata() != null ? new Metadata(jySubstitutionMappings.getJyMetadata()) : null;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("nodeTemplates", getNodeTemplates())
- .add("inputs", getInputs())
- .add("nodeDefinition", getNodeDefinition())
- .add("metadata", getMetadata())
- .toString();
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java
deleted file mode 100644
index 0d0dd10..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import static com.google.common.collect.ImmutableList.toImmutableList;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import org.openecomp.sdc.toscaparser.api.parameters.Input;
-import org.openecomp.sdc.toscaparser.jython.JyGroup;
-import org.openecomp.sdc.toscaparser.jython.JyNodeTemplate;
-import org.openecomp.sdc.toscaparser.jython.JySubstitutionMappings;
-import org.openecomp.sdc.toscaparser.jython.JyTopologyTemplate;
-import org.openecomp.sdc.toscaparser.jython.parameters.JyInput;
-
-import com.google.common.base.MoreObjects;
-
-public class TopologyTemplate {
-
- private final JyTopologyTemplate jyTopologyTemplate;
-
- public TopologyTemplate(JyTopologyTemplate jyTopologyTemplate) {
- this.jyTopologyTemplate = Objects.requireNonNull(jyTopologyTemplate);
- }
-
- public String getDescription() {
- return jyTopologyTemplate.getJyDescription();
- }
-
- public List<NodeTemplate> getNodeTemplates() {
- List<JyNodeTemplate> jyNodeTemplates = jyTopologyTemplate.getJyNodeTemplates();
- return jyNodeTemplates != null ? jyNodeTemplates
- .stream()
- .map(NodeTemplate::new)
- .collect(toImmutableList()) : new ArrayList<>();
- }
-
- public List<Input> getInputs() {
- List<JyInput> jyInputs = jyTopologyTemplate.getJyInputs();
- return jyInputs != null ? jyInputs
- .stream()
- .map(Input::new)
- .collect(toImmutableList()) : new ArrayList<>();
- }
-
- public List<Group> getGroups() {
- List<JyGroup> jyGroups = jyTopologyTemplate.getJyGroups();
- return jyGroups != null ? jyGroups
- .stream()
- .map(Group::new)
- .collect(toImmutableList()) : new ArrayList<>();
- }
-
- public SubstitutionMappings getSubstitutionMappings() {
- JySubstitutionMappings jySubstitutionMappings = jyTopologyTemplate.getJySubstitutionMappings();
- return jySubstitutionMappings != null ? new SubstitutionMappings(jySubstitutionMappings) : null;
- }
-
- public Metadata getMetadata() {
- return jyTopologyTemplate.getJyMetadata();
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("description", getDescription())
- .add("inputs", getInputs())
- .add("nodeTemplates", getNodeTemplates())
- .add("groups", getGroups())
- .add("substitutionMappings", getSubstitutionMappings())
- .add("metadata", getMetadata())
- .toString();
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
deleted file mode 100644
index 0aaafff..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import static com.google.common.collect.ImmutableList.toImmutableList;
-
-import java.util.List;
-import java.util.Objects;
-
-import org.openecomp.sdc.toscaparser.api.parameters.Input;
-import org.openecomp.sdc.toscaparser.jython.JyToscaTemplate;
-
-import com.google.common.base.MoreObjects;
-
-public class ToscaTemplate {
-
- private final JyToscaTemplate jyToscaTemplate;
- private final TopologyTemplate topologyTemplate;
-
- public ToscaTemplate(JyToscaTemplate jyToscaTemplate, TopologyTemplate topologyTemplate) {
- this.jyToscaTemplate = Objects.requireNonNull(jyToscaTemplate);
- this.topologyTemplate = Objects.requireNonNull(topologyTemplate);
- }
-
- public String getVersion() {
- return jyToscaTemplate.getJyVersion();
- }
-
- public Metadata getMetadata() {
- return jyToscaTemplate.getJyMetadata() != null ? new Metadata(jyToscaTemplate.getJyMetadata()) : null;
- }
-
- public String getDescription() {
- return jyToscaTemplate.getJyDescription();
- }
-
- public TopologyTemplate getTopologyTemplate() {
- return topologyTemplate;
- }
-
- public List<NodeTemplate> getNodeTemplates() {
- return topologyTemplate.getNodeTemplates();
- }
-
- public List<TopologyTemplate> getNestedTopologyTemplates() {
- return jyToscaTemplate.getJyNestedTopologyTemplates()
- .stream()
- .map(TopologyTemplate::new)
- .collect(toImmutableList());
- }
-
- public List<Input> getInputs() {
- return topologyTemplate.getInputs();
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("version", getVersion())
- .add("description", getDescription())
- .add("topologyTemplate", topologyTemplate)
- .add("nestedTopologyTemplates", getNestedTopologyTemplates())
- .toString();
- }
-} \ No newline at end of file
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplateFactory.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplateFactory.java
deleted file mode 100644
index 553c56b..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplateFactory.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.openecomp.sdc.toscaparser.api;
-
-import java.util.Objects;
-
-import org.openecomp.sdc.toscaparser.jython.JyToscaTemplate;
-
-public class ToscaTemplateFactory {
-
- public ToscaTemplate create(JyToscaTemplate jyToscaTemplate) {
- Objects.requireNonNull(jyToscaTemplate);
- TopologyTemplate topologyTemplate = new TopologyTemplate(jyToscaTemplate.getJyTopologyTemplate());
- return new ToscaTemplate(jyToscaTemplate, topologyTemplate);
- }
-} \ No newline at end of file
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/GroupType.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/GroupType.java
deleted file mode 100644
index 8e0bedf..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/GroupType.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.openecomp.sdc.toscaparser.api.elements;
-
-import org.openecomp.sdc.toscaparser.jython.elements.JyGroupType;
-
-import com.google.common.base.MoreObjects.ToStringHelper;
-
-public class GroupType extends StatefulEntityType {
-
- private final JyGroupType jyGroupType;
-
- public GroupType(JyGroupType jyGroupType) {
- super(jyGroupType);
- this.jyGroupType = jyGroupType;
- }
-
- public String getVersion() {
- return jyGroupType.getJyVersion();
- }
-
- public String getDescription() {
- return jyGroupType.getJyDescription();
- }
-
- @Override
- protected ToStringHelper toStringHelper() {
- return super.toStringHelper()
- .add("version", getVersion())
- .add("description", getDescription());
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java
deleted file mode 100644
index 69bd9ba..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.openecomp.sdc.toscaparser.api.elements;
-
-import java.util.List;
-
-import org.openecomp.sdc.toscaparser.jython.elements.JyNodeType;
-
-import com.google.common.base.MoreObjects.ToStringHelper;
-
-public class NodeType extends StatefulEntityType {
-
- private final JyNodeType jyNodeType;
-
- public NodeType(JyNodeType jyNodeType) {
- super(jyNodeType);
- this.jyNodeType = jyNodeType;
- }
-
- public List<?> getRequirements() {
- return jyNodeType.getJyRequirements();
- }
-
- @Override
- protected ToStringHelper toStringHelper() {
- return super.toStringHelper()
- .add("requirements", getRequirements());
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/StatefulEntityType.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/StatefulEntityType.java
deleted file mode 100644
index 32661b5..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/elements/StatefulEntityType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.openecomp.sdc.toscaparser.api.elements;
-
-import java.util.Objects;
-
-import org.openecomp.sdc.toscaparser.jython.elements.JyStatefulEntityType;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.MoreObjects.ToStringHelper;
-
-public abstract class StatefulEntityType {
-
- private final JyStatefulEntityType jyStatefulEntityType;
-
- public StatefulEntityType(JyStatefulEntityType jyStatefulEntityType) {
- this.jyStatefulEntityType = Objects.requireNonNull(jyStatefulEntityType);
- }
-
- public String getType() {
- return jyStatefulEntityType.getJyType();
- }
-
- protected ToStringHelper toStringHelper() {
- return MoreObjects.toStringHelper(this)
- .add("type", getType());
- }
-
- @Override
- public String toString() {
- return toStringHelper().toString();
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java
deleted file mode 100644
index 2339bb4..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.openecomp.sdc.toscaparser.api.parameters;
-
-import java.util.Objects;
-
-import org.openecomp.sdc.toscaparser.jython.parameters.JyInput;
-
-import com.google.common.base.MoreObjects;
-
-public class Input {
-
- private final JyInput jyInput;
-
- public Input(JyInput jyInput) {
- this.jyInput = Objects.requireNonNull(jyInput);
- }
-
- public String getName() {
- return jyInput.getJyName();
- }
-
- public String getType() {
- return jyInput.getJyType();
- }
-
- public boolean isRequired() {
- return jyInput.isJyRequired();
- }
-
- public String getDescription() {
- return jyInput.getJyDescription();
- }
-
- public Object getDefault() {
- return jyInput.getJyDefault();
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("name", getName())
- .add("type", getType())
- .add("required", isRequired())
- .add("description", getDescription())
- .add("default", getDefault())
- .toString();
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyCapability.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyCapability.java
deleted file mode 100644
index 1956932..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyCapability.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython;
-
-import java.util.List;
-
-public interface JyCapability {
-
- String getJyName();
- List<JyProperty> getJyProperties();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyEntityTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyEntityTemplate.java
deleted file mode 100644
index cdcb8a0..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyEntityTemplate.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython;
-
-import java.util.List;
-import java.util.Map;
-
-import org.openecomp.sdc.toscaparser.jython.elements.JyStatefulEntityType;
-
-public interface JyEntityTemplate {
-
- String getJyName();
- String getJyDescription();
- JyStatefulEntityType getJyTypeDefinition();
- List<JyProperty> getJyProperties();
- List<JyCapability> getJyCapabilities();
- List<Map<String, Map<String, Object>>> getJyRequirements();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java
deleted file mode 100644
index e12a31e..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyGroup.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython;
-
-import java.util.List;
-import java.util.Map;
-
-public interface JyGroup extends JyEntityTemplate {
-
- List<String> getJyMembers();
- Map<String, Object> getJyMetadata();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java
deleted file mode 100644
index 620cc1c..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyNodeTemplate.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython;
-
-import java.util.Map;
-
-public interface JyNodeTemplate extends JyEntityTemplate {
-
- Map<String, Object> getJyMetadata();
- JySubstitutionMappings getJySubstitutionMappings();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyProperty.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyProperty.java
deleted file mode 100644
index 4c33b92..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyProperty.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython;
-
-public interface JyProperty {
-
- String getJyName();
- Object getJyValue();
- String getJyValueClassName();
- String getJyType();
- boolean isJyRequired();
- String getJyDescription();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java
deleted file mode 100644
index 537aa89..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JySubstitutionMappings.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython;
-
-import java.util.List;
-import java.util.Map;
-
-import org.openecomp.sdc.toscaparser.jython.elements.JyNodeType;
-import org.openecomp.sdc.toscaparser.jython.parameters.JyInput;
-
-public interface JySubstitutionMappings {
-
- List<JyNodeTemplate> getJyNodeTemplates();
- List<JyInput> getJyInputs();
- List<JyGroup> getJyGroups();
- JyNodeType getJyNodeDefinition();
- Map<String, Object> getJyMetadata();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java
deleted file mode 100644
index d16ef5c..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyTopologyTemplate.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython;
-
-import java.util.List;
-
-import org.openecomp.sdc.toscaparser.api.Metadata;
-import org.openecomp.sdc.toscaparser.jython.parameters.JyInput;
-
-public interface JyTopologyTemplate {
-
- String getJyDescription();
- List<JyNodeTemplate> getJyNodeTemplates();
- List<JyInput> getJyInputs();
- List<JyGroup> getJyGroups();
- JySubstitutionMappings getJySubstitutionMappings();
- Metadata getJyMetadata();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java
deleted file mode 100644
index a2180c7..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython;
-
-import java.util.List;
-import java.util.Map;
-
-public interface JyToscaTemplate {
-
- String getJyVersion();
- String getJyDescription();
- List<JyNodeTemplate> getJyNodeTemplates();
- List<JyTopologyTemplate> getJyNestedTopologyTemplates();
- JyTopologyTemplate getJyTopologyTemplate();
- Map<String, Object> getJyMetadata();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyGroupType.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyGroupType.java
deleted file mode 100644
index 1ad2492..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyGroupType.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython.elements;
-
-public interface JyGroupType extends JyStatefulEntityType {
-
- String getJyVersion();
- String getJyDescription();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyNodeType.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyNodeType.java
deleted file mode 100644
index 885dcda..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyNodeType.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython.elements;
-
-import java.util.List;
-
-public interface JyNodeType extends JyStatefulEntityType {
-
- List<?> getJyRequirements();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyStatefulEntityType.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyStatefulEntityType.java
deleted file mode 100644
index 890bc6c..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/elements/JyStatefulEntityType.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython.elements;
-
-public interface JyStatefulEntityType {
-
- String getJyType();
- String getJyClassName();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java
deleted file mode 100644
index c1614ce..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.openecomp.sdc.toscaparser.jython.parameters;
-
-public interface JyInput {
-
- String getJyName();
- String getJyType();
- Object getJyDefault();
- boolean isJyRequired();
- String getJyDescription();
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/JarExtractor.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/JarExtractor.java
deleted file mode 100644
index 44feaa3..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/JarExtractor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.openecomp.sdc.toscaparser.utils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Enumeration;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.io.MoreFiles;
-import com.google.common.io.RecursiveDeleteOption;
-
-public class JarExtractor {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(JarExtractor.class);
- private static final String PYTHON_DEPENDENCIES_PATH = "Lib/site-packages";
- private static final String TEMP_DIR_PREFIX = "__tosca__";
-
- public Path extractPyhtonPackages() throws IOException {
- String codePath = getCodePath();
- if (!isRunningInJar(codePath)) {
- LOGGER.info("#extractPyhtonPackages - Nothing to extract, we're not running in a jar file.");
- return null;
- }
-
- Path tempDirPath = createTempDirectory();
- String tempDirName = tempDirPath.toString();
- extractJarDirectory(codePath, tempDirName);
- LOGGER.info("#extractPyhtonPackages - End. Extracted python dependencies to {}", tempDirName);
- return tempDirPath;
- }
-
- private Path createTempDirectory() throws IOException {
- Path tempDir = Files.createTempDirectory(TEMP_DIR_PREFIX);
- LOGGER.debug("#createTempDirectory - tempDir created: {}", tempDir);
- return tempDir;
- }
-
- private void extractJarDirectory(String jarDir, String tempDir) throws IOException {
- try (JarFile jarFile = new JarFile(jarDir)) {
- Enumeration<JarEntry> entries = jarFile.entries();
- while (entries.hasMoreElements()) {
- JarEntry entry = entries.nextElement();
- if (shouldExtract(entry)) {
- extract(jarFile, entry, tempDir);
- }
- }
- }
- }
-
- private void extract(JarFile jarFile, JarEntry entry, String tempDirName) throws IOException {
- try (InputStream source = jarFile.getInputStream(entry)) {
- Path targetPath = Paths.get(tempDirName, entry.getName());
- Files.createDirectories(targetPath.getParent());
- Files.copy(source, targetPath);
- }
- }
-
- private boolean shouldExtract(JarEntry entry) {
- return !entry.isDirectory() && entry.getName()
- .startsWith(PYTHON_DEPENDENCIES_PATH);
- }
-
- private String getCodePath() {
- String codePath = this.getClass()
- .getProtectionDomain()
- .getCodeSource()
- .getLocation()
- .getFile();
- LOGGER.debug("#getCodePath - codePath: {}", codePath);
- return codePath;
- }
-
- private boolean isRunningInJar(String path) {
- return path.endsWith(".jar");
- }
-
- public void deleteDirectory(Path path) throws IOException {
- MoreFiles.deleteRecursively(path, RecursiveDeleteOption.ALLOW_INSECURE);
- LOGGER.info("#deleteDirectory - deleted temp directory: {}", path);
- }
-}
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/PythonType.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/PythonType.java
deleted file mode 100644
index f4d6939..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/PythonType.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.openecomp.sdc.toscaparser.utils;
-
-import static java.util.stream.Collectors.toMap;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-
-public enum PythonType {
-
- INT("int", Integer.class),
- FLOAT("float", Double.class),
- BOOL("bool", Boolean.class),
- STR("str", String.class),
- LIST("list", List.class),
- DICT("dict", Map.class),
- UNKNOWN("", Object.class);
-
- private static final Map<String, PythonType> NAME_TO_TYPE;
- private final String typeName;
- private final Class<?> javaClass;
-
- static {
- NAME_TO_TYPE = Arrays.stream(values())
- .filter(type -> type != UNKNOWN)
- .collect(toMap(PythonType::getTypeName, Function.identity()));
- }
-
- private PythonType(String typeName, Class<?> javaClass) {
- this.typeName = typeName;
- this.javaClass = javaClass;
- }
-
- public static PythonType fromName(String name) {
- PythonType pythonType = NAME_TO_TYPE.get(name);
- return pythonType != null ? pythonType : UNKNOWN;
- }
-
- public String getTypeName() {
- return typeName;
- }
-
- public Class<?> getJavaClass() {
- return javaClass;
- }
-} \ No newline at end of file
diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/PythonUtils.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/PythonUtils.java
deleted file mode 100644
index f73c92b..0000000
--- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/utils/PythonUtils.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.openecomp.sdc.toscaparser.utils;
-
-public final class PythonUtils {
-
- private PythonUtils() {
- // No instances allowed
- }
-
- public static Object cast(Object object, String pythonTypeName) {
- PythonType pythonType = PythonType.fromName(pythonTypeName);
- return pythonType.getJavaClass().cast(object);
- }
-}