From 3db2feb37ac427a09790fef1ba637c16c3187ed6 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 26 Sep 2018 18:30:37 +0100 Subject: Allow custom JSON adapter specification In order to decode and encode complex Java POJOs with GSON, type adapters must be specified. This change allows specification of GSON type adapters for decoding and encoding of JSON in apex. Issue-ID: POLICY-954 Change-Id: Ib402d4e82c4f22fa4d532c016f77fb8e7bb568d3 Signed-off-by: liamfallon --- .../policy/apex/core/engine/EngineParameters.java | 37 +++++++++++++--------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'core') diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java index e0b0349de..d76d8e589 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.core.engine; import java.util.Map; +import java.util.Map.Entry; import java.util.TreeMap; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -28,18 +29,18 @@ import org.onap.policy.common.parameters.GroupValidationResult; import org.onap.policy.common.parameters.ParameterGroup; /** - * This class holds the parameters for a single Apex engine. This parameter class holds parameters - * for context schemas and context albums for the engine and a map of the logic flavour executors - * defined for the engine and the parameters for each of those executors. + * This class holds the parameters for a single Apex engine. This parameter class holds parameters for context schemas + * and context albums for the engine and a map of the logic flavour executors defined for the engine and the parameters + * for each of those executors. * - *

The context parameters for the engine are held in a {@link ContextParameters} instance. This - * instance holds the parameters for context schema handling that will be used by the engine as well - * as the context album distribution, locking, and persistence parameters. + *

The context parameters for the engine are held in a {@link ContextParameters} instance. This instance holds the + * parameters for context schema handling that will be used by the engine as well as the context album distribution, + * locking, and persistence parameters. * - *

In Apex, an engine can be configured to use many logic flavours. The executors for each logic - * flavour are identified by their name. Each logic flavour executor must have an instance of - * {@link ExecutorParameters} defined for it, which specifies the executor plugins to use for that - * logic flavour executor and specific parameters for those executor plugins. + *

In Apex, an engine can be configured to use many logic flavours. The executors for each logic flavour are + * identified by their name. Each logic flavour executor must have an instance of {@link ExecutorParameters} defined for + * it, which specifies the executor plugins to use for that logic flavour executor and specific parameters for those + * executor plugins. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -53,12 +54,11 @@ public class EngineParameters implements ParameterGroup { private Map executorParameterMap = new TreeMap<>(); /** - * Constructor to create an engine parameters instance and register the instance with the - * parameter service. + * Constructor to create an engine parameters instance and register the instance with the parameter service. */ public EngineParameters() { super(); - + // Set the name for the parameters this.name = EngineParameterConstants.MAIN_GROUP_NAME; } @@ -98,7 +98,7 @@ public class EngineParameters implements ParameterGroup { public void setExecutorParameterMap(final Map executorParameterMap) { this.executorParameterMap = executorParameterMap; } - + @Override public String getName() { return name; @@ -111,6 +111,13 @@ public class EngineParameters implements ParameterGroup { @Override public GroupValidationResult validate() { - return new GroupValidationResult(this); + final GroupValidationResult result = new GroupValidationResult(this); + + result.setResult("contextParameters", contextParameters.validate()); + + for (Entry executorParEntry : executorParameterMap.entrySet()) { + result.setResult("executorParameterMap", executorParEntry.getKey(), executorParEntry.getValue().validate()); + } + return result; } } -- cgit 1.2.3-korg