diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-08-30 09:37:29 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-08-31 19:23:41 +0100 |
commit | f32508381ce0b555fc14978cbaa458aa4e2d91c5 (patch) | |
tree | 1cab66e5372b6467f288ae1351ce836e4eba2d03 /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src | |
parent | 052038c7a7e0b385462b3b653b7d06094d472df3 (diff) |
Use parameter service in apex
Switch parameter handling in apex to use
the ONAP PF common parameter service
Change-Id: Id318d19c726b18b1a69c630fa81ca7d695355e9c
Issue-ID: POLICY-954
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src')
-rw-r--r-- | plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WEBSOCKETCarrierTechnologyParameters.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WEBSOCKETCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WEBSOCKETCarrierTechnologyParameters.java index e8009a5d8..e04a81d1d 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WEBSOCKETCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WEBSOCKETCarrierTechnologyParameters.java @@ -21,6 +21,8 @@ package org.onap.policy.apex.plugins.event.carrier.websocket; import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; +import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ValidationStatus; /** * Apex parameters for Kafka as an event carrier technology. @@ -56,7 +58,7 @@ public class WEBSOCKETCarrierTechnologyParameters extends CarrierTechnologyParam * parameter service. */ public WEBSOCKETCarrierTechnologyParameters() { - super(WEBSOCKETCarrierTechnologyParameters.class.getCanonicalName()); + super(); // Set the carrier technology properties for the web socket carrier technology this.setLabel(WEB_SCOKET_CARRIER_TECHNOLOGY_LABEL); @@ -97,19 +99,18 @@ public class WEBSOCKETCarrierTechnologyParameters extends CarrierTechnologyParam * @see org.onap.policy.apex.apps.uservice.parameters.ApexParameterValidator#validate() */ @Override - public String validate() { - final StringBuilder errorMessageBuilder = new StringBuilder(); - - errorMessageBuilder.append(super.validate()); + public GroupValidationResult validate() { + final GroupValidationResult result = super.validate(); if (wsClient && (host == null || host.trim().length() == 0)) { - errorMessageBuilder.append(" host not specified, must be host as a string\n"); + result.setResult("host", ValidationStatus.INVALID, "host not specified, must be host as a string"); } if (port < MIN_USER_PORT || port > MAX_USER_PORT) { - errorMessageBuilder.append(" port [" + port + "] invalid, must be specified as 1024 <= port <= 6535\n"); + result.setResult("port", ValidationStatus.INVALID, + "[" + port + "] invalid, must be specified as 1024 <= port <= 65535"); } - return errorMessageBuilder.toString(); + return result; } } |