summaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorRavi Mantena <rx908f@att.com>2020-12-04 11:23:42 -0500
committerRavi Mantena <rx908f@att.com>2020-12-04 13:34:30 -0500
commitc166c55c0b1674edc8e91ed1c270657473bf7f2b (patch)
treeb1e09b18a888233721eb446c6febb1e33b61de85 /mod
parentf6fc229608f2692ae666767ff49699acb1a795bb (diff)
Changing the snapshot and fixing Componentspec Issue-ID: DCAEGEN2-2529
Issue-ID: DCAEGEN2-2529 Change-Id: I4fb5eda94386c808c28431c9f8dbc7d5af2f8fc9 Signed-off-by: Ravi Mantena <rx908f@att.com>
Diffstat (limited to 'mod')
-rw-r--r--mod/bpgenerator/common/pom.xml2
-rw-r--r--mod/bpgenerator/onap/pom.xml4
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java38
3 files changed, 33 insertions, 11 deletions
diff --git a/mod/bpgenerator/common/pom.xml b/mod/bpgenerator/common/pom.xml
index 7c8db76..7f3a622 100644
--- a/mod/bpgenerator/common/pom.xml
+++ b/mod/bpgenerator/common/pom.xml
@@ -28,7 +28,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>blueprint-generator-common</artifactId>
- <version>2.0.0</version>
+ <version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Common</name>
diff --git a/mod/bpgenerator/onap/pom.xml b/mod/bpgenerator/onap/pom.xml
index 83572bd..f1b8373 100644
--- a/mod/bpgenerator/onap/pom.xml
+++ b/mod/bpgenerator/onap/pom.xml
@@ -28,7 +28,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>blueprint-generator-onap</artifactId>
- <version>1.7.0</version>
+ <version>1.7.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Onap</name>
@@ -44,7 +44,7 @@
<dependency>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>blueprint-generator-common</artifactId>
- <version>2.0.0</version>
+ <version>2.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java
index e8d648d..4991bda 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java
@@ -34,12 +34,9 @@ import java.io.File;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to create Component Spec from File
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service used by ONAP and
+ * DMAAP Blueprint to create Component Spec from File
*/
-
-
@Service("onapComponentSpecService")
public class ComponentSpecService {
@@ -51,16 +48,41 @@ public class ComponentSpecService {
@Autowired
private ObjectMapper yamlComponentMapper;
+ /**
+ * Creates ComponentSpec from given file path and validates if the input is json file or not
+ *
+ * @param componentSpecPath
+ * @return
+ */
public OnapComponentSpec createComponentSpecFromFile(String componentSpecPath) {
OnapComponentSpec componentSpec;
try {
- if(!componentSpecPath.endsWith(".json"))
- componentMapper = yamlComponentMapper;
- componentSpec = componentMapper.readValue(new File(componentSpecPath), OnapComponentSpec.class);
+ if (!componentSpecPath.endsWith(".json")) {
+ componentSpec = yamlComponentMapper.readValue(new File(componentSpecPath), OnapComponentSpec.class);
+ }else{
+ componentSpec = componentMapper.readValue(new File(componentSpecPath), OnapComponentSpec.class);
+ }
} catch (Exception ex) {
throw new ComponentSpecException("Unable to create ONAP Component Spec from the input file: "+ componentSpecPath, ex);
}
return componentSpec;
}
+ /**
+ * Creates the component spec from string.
+ * This method is used by RuntimeAPI
+ * @param specString the spec string
+ */
+ public OnapComponentSpec createComponentSpecFromString(String specString) {
+ OnapComponentSpec componentSpec;
+ try {
+ componentSpec = componentMapper.readValue(specString, OnapComponentSpec.class);
+ } catch (Exception ex) {
+ throw new ComponentSpecException(
+ "Unable to create ONAP Component Spec from the input string: " + specString,
+ ex);
+ }
+ return componentSpec;
+ }
+
}