summaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/main/java/org
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-20 21:13:19 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-20 23:22:35 +0100
commita02548ec2e98a8a13cd76ecc83379b13cd26030b (patch)
tree1159028f8ac452b61fa4dc0e4a510ba7100ace26 /services/services-engine/src/main/java/org
parentaece3940d349329efe6d220961f6f2a487f90565 (diff)
Fix bug with POJO events in APex
When an envet should be decoded entirely into a POJO and is too complex for Avro, apex decoding breaks. This reviuew fixes thsi issue. Issue-ID: POLICY-1034 Change-Id: Iccd739c4bb5c1645a2a7165f5bbfdfd4b964d79e Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'services/services-engine/src/main/java/org')
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/ApexEventProtocolParameters.java7
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java306
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java47
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java4
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java6
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java7
6 files changed, 294 insertions, 83 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/ApexEventProtocolParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/ApexEventProtocolParameters.java
index 27970f982..b9e1648f1 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/ApexEventProtocolParameters.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/ApexEventProtocolParameters.java
@@ -36,17 +36,16 @@ public class ApexEventProtocolParameters extends EventProtocolParameters {
* service.
*/
public ApexEventProtocolParameters() {
- this(ApexEventProtocolParameters.class.getCanonicalName(), APEX_EVENT_PROTOCOL_LABEL);
+ this(APEX_EVENT_PROTOCOL_LABEL);
}
/**
* Constructor to create an event protocol parameters instance with the name of a sub class of this class.
*
- * @param parameterClassName the class name of a sub class of this class
* @param eventProtocolLabel the name of the event protocol for this plugin
*/
- public ApexEventProtocolParameters(final String parameterClassName, final String eventProtocolLabel) {
- super(parameterClassName);
+ public ApexEventProtocolParameters(final String eventProtocolLabel) {
+ super();
// Set the event protocol properties for the JSON event protocol
this.setLabel(eventProtocolLabel);
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java
index 343ef9ac0..78b96ed2c 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java
@@ -26,6 +26,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import org.onap.policy.apex.context.SchemaHelper;
@@ -51,6 +52,10 @@ import org.slf4j.ext.XLoggerFactory;
public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
private static final XLogger LOGGER = XLoggerFactory.getXLogger(Apex2JsonEventConverter.class);
+ // Recurring string constants
+ private static final String ERROR_PARSING = "error parsing ";
+ private static final String ERROR_CODING = "error coding ";
+
// The parameters for the JSON event protocol
private JsonEventProtocolParameters jsonPars;
@@ -106,21 +111,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
// Check if we have a list of objects
if (decodedJsonObject instanceof List) {
- // Check if it's a list of JSON objects or a list of strings
- @SuppressWarnings("unchecked")
- final List<Object> decodedJsonList = (List<Object>) decodedJsonObject;
-
- // Decode each of the list elements in sequence
- for (final Object jsonListObject : decodedJsonList) {
- if (jsonListObject instanceof String) {
- eventList.add(jsonStringApexEvent(eventName, (String) jsonListObject));
- } else if (jsonListObject instanceof JsonObject) {
- eventList.add(jsonObject2ApexEvent(eventName, (JsonObject) jsonListObject));
- } else {
- throw new ApexEventException("incoming event (" + jsonEventString
- + ") is a JSON object array containing an invalid object " + jsonListObject);
- }
- }
+ eventList.addAll(decodeEventList(eventName, jsonEventString, decodedJsonObject));
} else {
eventList.add(jsonStringApexEvent(eventName, jsonEventString));
}
@@ -135,6 +126,39 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
return eventList;
}
+ /**
+ * Decode a list of Apex events.
+ *
+ * @param eventName the name of the incoming events
+ * @param jsonEventString the JSON representation of the event list
+ * @param decodedJsonObject The JSON list object
+ * @return a list of decoded Apex events
+ * @throws ApexEventException on event decoding errors
+ */
+ private Collection<? extends ApexEvent> decodeEventList(final String eventName, String jsonEventString,
+ final Object decodedJsonObject) throws ApexEventException {
+
+ final List<ApexEvent> eventList = new ArrayList<>();
+
+ // Check if it's a list of JSON objects or a list of strings
+ @SuppressWarnings("unchecked")
+ final List<Object> decodedJsonList = (List<Object>) decodedJsonObject;
+
+ // Decode each of the list elements in sequence
+ for (final Object jsonListObject : decodedJsonList) {
+ if (jsonListObject instanceof String) {
+ eventList.add(jsonStringApexEvent(eventName, (String) jsonListObject));
+ } else if (jsonListObject instanceof JsonObject) {
+ eventList.add(jsonObject2ApexEvent(eventName, (JsonObject) jsonListObject));
+ } else {
+ throw new ApexEventException("incoming event (" + jsonEventString
+ + ") is a JSON object array containing an invalid object " + jsonListObject);
+ }
+ }
+
+ return eventList;
+ }
+
/*
* (non-Javadoc)
*
@@ -149,6 +173,22 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
throw new ApexEventException("event processing failed, Apex event is null");
}
+ if (jsonPars.getPojoField() == null) {
+ return fromApexEventWithFields(apexEvent);
+ } else {
+ return fromApexEventPojo(apexEvent);
+ }
+ }
+
+ /**
+ /**
+ * Serialise an Apex event to a JSON string field by field.
+ *
+ * @param apexEvent the event to Serialise
+ * @return the Serialise event as JSON
+ * @throws ApexEventException exceptions on marshaling to JSON
+ */
+ private Object fromApexEventWithFields(final ApexEvent apexEvent) {
// Get the event definition for the event from the model service
final AxEvent eventDefinition = ModelService.getModel(AxEvents.class).get(apexEvent.getName(),
apexEvent.getVersion());
@@ -172,7 +212,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
if (!apexEvent.containsKey(fieldName)) {
if (!eventField.getOptional()) {
- final String errorMessage = "error parsing " + eventDefinition.getId() + " event to Json. "
+ final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json. "
+ "Field \"" + fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent;
LOGGER.debug(errorMessage);
throw new ApexEventRuntimeException(errorMessage);
@@ -193,6 +233,51 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
}
/**
+ * Serialise an Apex event to a JSON string as a single POJO.
+ *
+ * @param apexEvent the event to Serialise
+ * @return the Serialise event as JSON
+ * @throws ApexEventException exceptions on marshaling to JSON
+ */
+ private Object fromApexEventPojo(ApexEvent apexEvent) throws ApexEventException {
+ // Get the event definition for the event from the model service
+ final AxEvent eventDefinition = ModelService.getModel(AxEvents.class).get(apexEvent.getName(),
+ apexEvent.getVersion());
+
+ if (eventDefinition.getFields().isEmpty()) {
+ final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json, Field "
+ + jsonPars.getPojoField() + " not found, no fields defined on event.";
+ LOGGER.debug(errorMessage);
+ throw new ApexEventException(errorMessage);
+ }
+
+ if (eventDefinition.getFields().size() != 1) {
+ final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json, Field "
+ + jsonPars.getPojoField() + ", "
+ + " one and only one field may be defined on a POJO event definition.";
+ LOGGER.debug(errorMessage);
+ throw new ApexEventException(errorMessage);
+ }
+
+ AxField pojoFieldDefinition = eventDefinition.getFields().iterator().next();
+
+ if (!jsonPars.getPojoField().equals(pojoFieldDefinition.getKey().getLocalName())) {
+ final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json. Field "
+ + jsonPars.getPojoField() + " not found on POJO event definition.";
+ LOGGER.debug(errorMessage);
+ throw new ApexEventException(errorMessage);
+ }
+
+ final Object fieldValue = apexEvent.get(jsonPars.getPojoField());
+
+ // Get the schema helper
+ final SchemaHelper fieldSchemaHelper = new SchemaHelperFactory()
+ .createSchemaHelper(pojoFieldDefinition.getKey(), pojoFieldDefinition.getSchema());
+
+ return fieldSchemaHelper.marshal2String(fieldValue);
+ }
+
+ /**
* This method converts a JSON object into an Apex event.
*
* @param eventName the name of the event
@@ -231,12 +316,31 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
final AxEvent eventDefinition = ModelService.getModel(AxEvents.class).get(apexEvent.getName(),
apexEvent.getVersion());
+ if (jsonPars.getPojoField() == null) {
+ jsonObject2ApexEventWithFields(jsonObject, apexEvent, eventDefinition);
+ } else {
+ jsonObject2ApexEventPojo(jsonObject, apexEvent, eventDefinition);
+ }
+
+ return apexEvent;
+ }
+
+ /**
+ * Decode an Apex event field by field.
+ *
+ * @param jsonObject the JSON representation of the event
+ * @param apexEvent the incoming event header
+ * @param eventDefinition the definition of the event from the model
+ * @throws ApexEventException on decode errors
+ */
+ private void jsonObject2ApexEventWithFields(final JsonObject jsonObject, final ApexEvent apexEvent,
+ final AxEvent eventDefinition) throws ApexEventException {
// Iterate over the input fields in the event
for (final AxField eventField : eventDefinition.getFields()) {
final String fieldName = eventField.getKey().getLocalName();
if (!hasJsonField(jsonObject, fieldName)) {
if (!eventField.getOptional()) {
- final String errorMessage = "error parsing " + eventDefinition.getId() + " event from Json. "
+ final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json. "
+ "Field \"" + fieldName + "\" is missing, but is mandatory.";
LOGGER.debug(errorMessage);
throw new ApexEventException(errorMessage);
@@ -255,53 +359,140 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
apexEvent.put(fieldName, null);
}
}
- return apexEvent;
+ }
+
+ /**
+ * Decode an Apex event as a single POJO.
+ *
+ * @param jsonObject the JSON representation of the event
+ * @param apexEvent the incoming event header
+ * @param eventDefinition the definition of the event from the model
+ * @throws ApexEventException on decode errors
+ */
+ private void jsonObject2ApexEventPojo(JsonObject jsonObject, ApexEvent apexEvent, AxEvent eventDefinition)
+ throws ApexEventException {
+ if (eventDefinition.getFields().isEmpty()) {
+ final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json, Field "
+ + jsonPars.getPojoField() + " not found, no fields defined on event.";
+ LOGGER.debug(errorMessage);
+ throw new ApexEventException(errorMessage);
+ }
+
+ if (eventDefinition.getFields().size() != 1) {
+ final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json, Field "
+ + jsonPars.getPojoField()
+ + ", one and only one field may be defined on a POJO event definition.";
+ LOGGER.debug(errorMessage);
+ throw new ApexEventException(errorMessage);
+ }
+
+ AxField pojoFieldDefinition = eventDefinition.getFields().iterator().next();
+
+ if (!jsonPars.getPojoField().equals(pojoFieldDefinition.getKey().getLocalName())) {
+ final String errorMessage = ERROR_PARSING + eventDefinition.getId() + " event from Json. Field "
+ + jsonPars.getPojoField() + " not found on POJO event definition.";
+ LOGGER.debug(errorMessage);
+ throw new ApexEventException(errorMessage);
+ }
+
+ // Get the schema helper
+ final SchemaHelper fieldSchemaHelper = new SchemaHelperFactory()
+ .createSchemaHelper(pojoFieldDefinition.getKey(), pojoFieldDefinition.getSchema());
+ apexEvent.put(jsonPars.getPojoField(), fieldSchemaHelper.createNewInstance(jsonObject));
}
/**
* This method processes the event header of an Apex event.
*
- * @param eventName the name of the event
+ * @param parameterEventName the name of the event from the parameters
* @param jsonObject the JSON object containing the JSON representation of the incoming event
* @return an apex event constructed using the header fields of the event
* @throws ApexEventRuntimeException the apex event runtime exception
* @throws ApexEventException on invalid events with missing header fields
*/
- private ApexEvent processApexEventHeader(final String eventName, final JsonObject jsonObject)
+ private ApexEvent processApexEventHeader(final String parameterEventName, final JsonObject jsonObject)
throws ApexEventException {
- String name = getJsonStringField(jsonObject, ApexEvent.NAME_HEADER_FIELD, jsonPars.getNameAlias(),
- ApexEvent.NAME_REGEXP, false);
+
+ final String eventName = getHeaderName(jsonObject, parameterEventName);
+
+ String eventVersion = getHeaderVersion(jsonObject);
+
+ final AxEvent eventDefinition = ModelService.getModel(AxEvents.class).get(eventName, eventVersion);
+
+ if (eventDefinition == null) {
+ if (eventVersion == null) {
+ throw new ApexEventRuntimeException(
+ "an event definition for an event named \"" + eventName + "\" not found in Apex model");
+ } else {
+ throw new ApexEventRuntimeException("an event definition for an event named \"" + eventName
+ + "\" with version \"" + eventVersion + "\" not found in Apex model");
+ }
+ }
+
+ // Use the defined event version if no version is specified on the incoming fields
+ if (eventVersion == null) {
+ eventVersion = eventDefinition.getKey().getVersion();
+ }
+
+ final String eventNamespace = getHeaderNamespace(jsonObject, eventName, eventDefinition);
+ final String eventSource = getHeaderSource(jsonObject, eventDefinition);
+ final String eventTarget = getHeaderTarget(jsonObject, eventDefinition);
+
+ return new ApexEvent(eventName, eventVersion, eventNamespace, eventSource, eventTarget);
+ }
+
+ /**
+ * Determine the name field of the event header.
+ *
+ * @param jsonObject the event in JSON format
+ * @param parameterEventName the configured event name from the parameters
+ * @return the event name to use on the event header
+ */
+ private String getHeaderName(final JsonObject jsonObject, final String parameterEventName) {
+ final String jsonEventName = getJsonStringField(jsonObject, ApexEvent.NAME_HEADER_FIELD,
+ jsonPars.getNameAlias(), ApexEvent.NAME_REGEXP, false);
// Check that an event name has been specified
- if (name == null && eventName == null) {
+ if (jsonEventName == null && parameterEventName == null) {
throw new ApexEventRuntimeException(
"event received without mandatory parameter \"name\" on configuration or on event");
}
// Check if an event name was specified on the event parameters
- if (eventName != null) {
- if (name != null && !eventName.equals(name)) {
+ if (jsonEventName != null) {
+ if (parameterEventName != null && !parameterEventName.equals(jsonEventName)) {
LOGGER.warn("The incoming event name \"{}\" does not match the configured event name \"{}\","
- + " using configured event name", name, eventName);
+ + " using configured event name", jsonEventName, parameterEventName);
}
- name = eventName;
+ return jsonEventName;
+ } else {
+ return parameterEventName;
}
+ }
- // Now, find the event definition in the model service. If version is null, the newest event
+ /**
+ * Determine the version field of the event header.
+ *
+ * @param jsonObject the event in JSON format
+ * @return the event version
+ */
+ private String getHeaderVersion(final JsonObject jsonObject) {
+ // Find the event definition in the model service. If version is null, the newest event
// definition in the model service is used
- String version = getJsonStringField(jsonObject, ApexEvent.VERSION_HEADER_FIELD, jsonPars.getVersionAlias(),
+ return getJsonStringField(jsonObject, ApexEvent.VERSION_HEADER_FIELD, jsonPars.getVersionAlias(),
ApexEvent.VERSION_REGEXP, false);
- final AxEvent eventDefinition = ModelService.getModel(AxEvents.class).get(name, version);
- if (eventDefinition == null) {
- throwVersionException(name, version);
- }
-
- // Use the defined event version if no version is specified on the incoming fields
- if (version == null) {
- version = eventDefinition.getKey().getVersion();
- }
+ }
+ /**
+ * Determine the name space field of the event header.
+ *
+ * @param jsonObject the event in JSON format
+ * @param eventName the name of the event
+ * @param eventDefinition the definition of the event structure
+ * @return the event version
+ */
+ private String getHeaderNamespace(final JsonObject jsonObject, final String name, final AxEvent eventDefinition) {
// Check the name space is OK if it is defined, if not, use the name space from the model
String namespace = getJsonStringField(jsonObject, ApexEvent.NAMESPACE_HEADER_FIELD,
jsonPars.getNameSpaceAlias(), ApexEvent.NAMESPACE_REGEXP, false);
@@ -314,38 +505,41 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
} else {
namespace = eventDefinition.getNameSpace();
}
+ return namespace;
+ }
+ /**
+ * Determine the source field of the event header.
+ *
+ * @param jsonObject the event in JSON format
+ * @param eventDefinition the definition of the event structure
+ * @return the event version
+ */
+ private String getHeaderSource(final JsonObject jsonObject, final AxEvent eventDefinition) {
// For source, use the defined source only if the source is not found on the incoming event
String source = getJsonStringField(jsonObject, ApexEvent.SOURCE_HEADER_FIELD, jsonPars.getSourceAlias(),
ApexEvent.SOURCE_REGEXP, false);
if (source == null) {
source = eventDefinition.getSource();
}
+ return source;
+ }
+ /**
+ * Determine the target field of the event header.
+ *
+ * @param jsonObject the event in JSON format
+ * @param eventDefinition the definition of the event structure
+ * @return the event version
+ */
+ private String getHeaderTarget(final JsonObject jsonObject, final AxEvent eventDefinition) {
// For target, use the defined source only if the source is not found on the incoming event
String target = getJsonStringField(jsonObject, ApexEvent.TARGET_HEADER_FIELD, jsonPars.getTargetAlias(),
ApexEvent.TARGET_REGEXP, false);
if (target == null) {
target = eventDefinition.getTarget();
}
-
- return new ApexEvent(name, version, namespace, source, target);
- }
-
- /**
- * Throw an exception on event name and/or version with the correct text.
- * @param name The event name
- * @param version The event version
- */
- private void throwVersionException(String name, String version) {
- if (version == null) {
- throw new ApexEventRuntimeException(
- "an event definition for an event named \"" + name + "\" not found in Apex model");
- }
- else {
- throw new ApexEventRuntimeException("an event definition for an event named \"" + name
- + "\" with version \"" + version + "\" not found in Apex model");
- }
+ return target;
}
/**
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java
index 8e44ec59b..5ff795d76 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java
@@ -22,6 +22,7 @@ package org.onap.policy.apex.service.engine.event.impl.jsonprotocolplugin;
import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolTextCharDelimitedParameters;
+// @formatter:off
/**
* Event protocol parameters for JSON as an event protocol.
*
@@ -37,10 +38,14 @@ import org.onap.policy.apex.service.parameters.eventprotocol.EventProtocolTextCh
* parameter is optional.
* <li>targetAlias: The field in a JSON event to use as an alias for the event target. This
* parameter is optional.
+ * <li>pojoField: The event is received and sent as a single POJO using the event field
+ * definition in this field name in the schema, there must be one and only one field in the
+ * event definition, the event has a single parameter whose type is the Pojo. This parameter is optional.
* </ol>
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+//@formatter:on
public class JsonEventProtocolParameters extends EventProtocolTextCharDelimitedParameters {
/** The label of this event protocol. */
public static final String JSON_EVENT_PROTOCOL_LABEL = "JSON";
@@ -58,23 +63,23 @@ public class JsonEventProtocolParameters extends EventProtocolTextCharDelimitedP
private String targetAlias = null;
// @formatter:on
+ // Flag indicating POJO decoding and encoding and parameter indicating the name of the Pojo field
+ private String pojoField = null;
+
/**
- * Constructor to create a JSON event protocol parameter instance and register the instance with
- * the parameter service.
+ * Constructor to create a JSON event protocol parameter instance and register the instance with the parameter
+ * service.
*/
public JsonEventProtocolParameters() {
- this(JsonEventProtocolParameters.class.getCanonicalName(), JSON_EVENT_PROTOCOL_LABEL);
+ this(JSON_EVENT_PROTOCOL_LABEL);
}
/**
- * Constructor to create an event protocol parameters instance with the name of a sub class of
- * this class.
- *
- * @param parameterClassName the class name of a sub class of this class
+ * Constructor to create an event protocol parameters instance with the name of a sub class of this class.
* @param eventProtocolLabel the name of the event protocol for this plugin
*/
- public JsonEventProtocolParameters(final String parameterClassName, final String eventProtocolLabel) {
- super(parameterClassName);
+ public JsonEventProtocolParameters(final String eventProtocolLabel) {
+ super();
// Set the event protocol properties for the JSON event protocol
this.setLabel(eventProtocolLabel);
@@ -87,7 +92,9 @@ public class JsonEventProtocolParameters extends EventProtocolTextCharDelimitedP
this.setEventProtocolPluginClass(Apex2JsonEventConverter.class.getCanonicalName());
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.onap.policy.common.parameters.ParameterGroup#getName()
*/
@Override
@@ -139,7 +146,16 @@ public class JsonEventProtocolParameters extends EventProtocolTextCharDelimitedP
public String getTargetAlias() {
return targetAlias;
}
-
+
+ /**
+ * Return the name of the POJO field to use for POJO decoding and encoding.
+ *
+ * @return the name of the POJO field
+ */
+ public String getPojoField() {
+ return pojoField;
+ }
+
/**
* Sets the name alias.
*
@@ -184,4 +200,13 @@ public class JsonEventProtocolParameters extends EventProtocolTextCharDelimitedP
public void setTargetAlias(String targetAlias) {
this.targetAlias = targetAlias;
}
+
+ /**
+ * Sets the POJO field that name for POJO decoding and encoding.
+ *
+ * @param pojoField The name of the POJO field to use on the event
+ */
+ public void setPojoField(final String pojoField) {
+ this.pojoField = pojoField;
+ }
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java
index 29afc4edb..92efb53b3 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParameters.java
@@ -48,10 +48,8 @@ public abstract class EventProtocolParameters implements ParameterGroup {
/**
* Constructor to create an event protocol parameters instance with the name of a sub class of this class and
* register the instance with the parameter service.
- *
- * @param parameterClassName the class name of a sub class of this class
*/
- public EventProtocolParameters(final String parameterClassName) {
+ public EventProtocolParameters() {
super();
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java
index bf8d1a5e1..8d8766772 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextCharDelimitedParameters.java
@@ -42,11 +42,9 @@ public abstract class EventProtocolTextCharDelimitedParameters extends EventProt
/**
* Constructor to create an event protocol parameters instance with the name of a sub class of this class.
- *
- * @param parameterClassName the class name of a sub class of this class
*/
- public EventProtocolTextCharDelimitedParameters(final String parameterClassName) {
- super(parameterClassName);
+ public EventProtocolTextCharDelimitedParameters() {
+ super();
}
/**
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java
index dce2ee2c3..402d015fc 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolTextTokenDelimitedParameters.java
@@ -47,12 +47,9 @@ public abstract class EventProtocolTextTokenDelimitedParameters extends EventPro
/**
* Constructor to create an event protocol parameters instance with the name of a sub class of this class.
- *
- * @param parameterClassName
- * the class name of a sub class of this class
*/
- public EventProtocolTextTokenDelimitedParameters(final String parameterClassName) {
- super(parameterClassName);
+ public EventProtocolTextTokenDelimitedParameters() {
+ super();
}
/**