aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkris.jinka <kris.jinka@samsung.com>2018-11-16 20:16:14 +0900
committerkris.jinka <kris.jinka@samsung.com>2018-11-16 20:16:27 +0900
commit359458bc3a10c3969eaf62263fb6211f7bd86c13 (patch)
treea9aee16239644db128d7b4a3421921f91902da76
parent96b3a0059c5900f33d8c1b4f4295f6d84177e2bf (diff)
Modify decoder to use param obj
Modify decoder to use param object for sonar issue fix Issue-ID: POLICY-1251 Change-Id: Iae68ba276f02be51058037b56d901a131b25838e Signed-off-by: kris.jinka <kris.jinka@samsung.com>
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java14
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java53
2 files changed, 32 insertions, 35 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
index ef20b84d..c707c8fc 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
@@ -305,11 +305,15 @@ public class MavenDroolsController implements DroolsController {
}
if (decoder) {
- EventProtocolCoder.manager.addDecoder(this.getGroupId(), this.getArtifactId(),
- topic, potentialCodedClass, protocolFilter,
- customGsonCoder,
- customJacksonCoder,
- this.policyContainer.getClassLoader().hashCode());
+ EventProtocolCoder.manager.addDecoder(EventProtocolParams.builder()
+ .groupId(this.getGroupId())
+ .artifactId(this.getArtifactId())
+ .topic(topic)
+ .eventClass(potentialCodedClass)
+ .protocolFilter(protocolFilter)
+ .customGsonCoder(customGsonCoder)
+ .customJacksonCoder(customJacksonCoder)
+ .modelClassLoaderHash(this.policyContainer.getClassLoader().hashCode()));
} else {
EventProtocolCoder.manager.addEncoder(
EventProtocolParams.builder().groupId(this.getGroupId())
diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java
index b9cb568c..1afd81a3 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java
@@ -130,23 +130,11 @@ public interface EventProtocolCoder {
/**
* Adds a Decoder class to decode the protocol over this topic.
- *
- * @param groupId of the controller
- * @param artifactId of the controller
- * @param topic the topic
- * @param eventClass the event class
- * @param protocolFilter filters to selectively choose a particular decoder
- * when there are multiples
- *
+ *
+ * @param eventProtocolParams parameter object for event protocol
* @throw IllegalArgumentException if an invalid parameter is passed
*/
- public void addDecoder(String groupId, String artifactId,
- String topic,
- String eventClass,
- JsonProtocolFilter protocolFilter,
- CustomGsonCoder customGsonCoder,
- CustomJacksonCoder customJacksonCoder,
- int modelClassLoaderHash);
+ public void addDecoder(EventProtocolParams eventProtocolParams);
/**
* removes all decoders associated with the controller id.
@@ -280,9 +268,9 @@ public interface EventProtocolCoder {
/**
* Adds a Encoder class to encode the protocol over this topic.
- *
*
- * @param eventProtocolParams@throw IllegalArgumentException if an invalid parameter is passed
+ * @param eventProtocolParams parameter object for event protocol
+ * @throw IllegalArgumentException if an invalid parameter is passed
*/
public void addEncoder(EventProtocolParams eventProtocolParams);
@@ -401,18 +389,23 @@ class MultiplexorEventProtocolCoder implements EventProtocolCoder {
* {@inheritDoc}.
*/
@Override
- public void addDecoder(String groupId, String artifactId, String topic,
- String eventClass,
- JsonProtocolFilter protocolFilter,
- CustomGsonCoder customGsonCoder,
- CustomJacksonCoder customJacksonCoder,
- int modelClassLoaderHash) {
- logger.info("{}: add-decoder {}:{}:{}:{}:{}:{}:{}:{}", this,
- groupId, artifactId, topic, eventClass,
- protocolFilter, customGsonCoder, customJacksonCoder,
- modelClassLoaderHash);
- this.decoders.add(groupId, artifactId, topic, eventClass, protocolFilter,
- customGsonCoder, customJacksonCoder, modelClassLoaderHash);
+ public void addDecoder(EventProtocolParams eventProtocolParams) {
+ logger.info("{}: add-decoder {}:{}:{}:{}:{}:{}:{}:{}", this,
+ eventProtocolParams.getGroupId(),
+ eventProtocolParams.getArtifactId(),
+ eventProtocolParams.getTopic(),
+ eventProtocolParams.getEventClass(),
+ eventProtocolParams.getProtocolFilter(),
+ eventProtocolParams.getCustomGsonCoder(),
+ eventProtocolParams.getCustomJacksonCoder(),
+ eventProtocolParams.getModelClassLoaderHash());
+ this.decoders.add(eventProtocolParams.getGroupId(), eventProtocolParams.getArtifactId(),
+ eventProtocolParams.getTopic(),
+ eventProtocolParams.getEventClass(),
+ eventProtocolParams.getProtocolFilter(),
+ eventProtocolParams.getCustomGsonCoder(),
+ eventProtocolParams.getCustomJacksonCoder(),
+ eventProtocolParams.getModelClassLoaderHash());
}
/**
@@ -796,7 +789,7 @@ abstract class GenericEventProtocolCoder {
/**
* produces key for indexing toolset entries.
*
- * @param group group id
+ * @param groupId group id
* @param artifactId artifact id
* @param topic topic
* @return index key