diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-03-01 15:20:33 +0100 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-03-01 15:20:33 +0100 |
commit | b42ef89649fc86f7912b40a6da22fb069baa94a0 (patch) | |
tree | 6d57603905095c43622b464f08465069a52acb7b /src/main/java | |
parent | 44508f217d6df709ff4b9adbbe2898dfa9dee25e (diff) |
Rework CldsReferenceProp class
Refactor the code and insert new config for SDC client code
Issue-ID: CLAMP-81
Change-Id: Ifabf220e7bf0067e689242f3f1ef09503b11fe87
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/config/CldsReferenceProperties.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/org/onap/clamp/clds/config/CldsReferenceProperties.java b/src/main/java/org/onap/clamp/clds/config/CldsReferenceProperties.java index a8acdee14..c0f7a7286 100644 --- a/src/main/java/org/onap/clamp/clds/config/CldsReferenceProperties.java +++ b/src/main/java/org/onap/clamp/clds/config/CldsReferenceProperties.java @@ -50,12 +50,20 @@ public class CldsReferenceProperties { private String cldsReferenceValuesFile; @PostConstruct - public void loadConfig() throws IOException { + public void loadConfiguration() throws IOException { prop = new Properties(); Resource resource = appContext.getResource(cldsReferenceValuesFile); prop.load(resource.getInputStream()); } + public CldsReferenceProperties(String referenceValuesFile) throws IOException { + cldsReferenceValuesFile = referenceValuesFile; + loadConfiguration(); + } + + public CldsReferenceProperties() { + } + /** * get property value * @@ -105,6 +113,7 @@ public class CldsReferenceProperties { */ public JsonNode getJsonTemplate(String key1, String key2) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); - return objectMapper.readValue(getStringValue(key1, key2), JsonNode.class); + String result = getStringValue(key1, key2); + return (result != null) ? objectMapper.readValue(result, JsonNode.class) : null; } } |