From a0ba464faeb2e979d20758bc1091143108355974 Mon Sep 17 00:00:00 2001 From: Michal Banka Date: Tue, 4 Aug 2020 14:58:25 +0200 Subject: Add implementation of stndDefined fields validation Added implementation of stndDefined fields from incoming events. Validation is performed using external-schema-manager tool from DCAE SDK. StndDefined fields schemas are stored in etc/externalRepo directory. Additional stndDefined related properties has been added to collector.properties. VES version has been set to 1.7.3. Issue-ID: DCAEGEN2-2254 Signed-off-by: Edyta Krukowska Signed-off-by: Michal Banka Change-Id: Iedaa3622b1d527f6794822c8867b9dfd1860bb8f --- .../java/org/onap/dcae/ApplicationSettings.java | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/main/java/org/onap/dcae/ApplicationSettings.java') diff --git a/src/main/java/org/onap/dcae/ApplicationSettings.java b/src/main/java/org/onap/dcae/ApplicationSettings.java index 33ad5bc7..7d5c7db2 100644 --- a/src/main/java/org/onap/dcae/ApplicationSettings.java +++ b/src/main/java/org/onap/dcae/ApplicationSettings.java @@ -55,6 +55,8 @@ public class ApplicationSettings { private static final Logger log = LoggerFactory.getLogger(ApplicationSettings.class); private static final String FALLBACK_VES_VERSION = "v5"; + private static final int DISABLED = -1; + private static final int ENABLED = 1; private final String appInvocationDir; private final String configurationFileLocation; private final PropertiesConfiguration properties = new PropertiesConfiguration(); @@ -96,7 +98,7 @@ public class ApplicationSettings { } public boolean eventSchemaValidationEnabled() { - return properties.getInt("collector.schema.checkflag", -1) > 0; + return properties.getInt("collector.schema.checkflag", DISABLED) > 0; } public JsonSchema jsonSchema(String version) { @@ -126,7 +128,7 @@ public class ApplicationSettings { } public boolean eventTransformingEnabled() { - return properties.getInt("event.transform.flag", 1) > 0; + return properties.getInt("event.transform.flag", ENABLED) > 0; } public String keystorePasswordFileLocation() { @@ -170,6 +172,26 @@ public class ApplicationSettings { } } + public boolean getExternalSchemaValidationCheckflag() { + return properties.getInt("collector.externalSchema.checkflag", DISABLED) > 0; + } + + public String getExternalSchemaSchemasLocation() { + return properties.getString("collector.externalSchema.schemasLocation", "./etc/externalRepo"); + } + + public String getExternalSchemaMappingFileLocation() { + return properties.getString("collector.externalSchema.mappingFileLocation", "./etc/externalRepo/schema-map.json"); + } + + public String getExternalSchemaSchemaRefPath() { + return properties.getString("event.externalSchema.schemaRefPath", "/event/stndDefinedFields/schemaReference"); + } + + public String getExternalSchemaStndDefinedDataPath() { + return properties.getString("event.externalSchema.stndDefinedDataPath", "/event/stndDefinedFields/data"); + } + public List getEventTransformations() { return eventTransformations; } -- cgit 1.2.3-korg