aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2018-12-03 14:35:21 +0000
committerliamfallon <liam.fallon@est.tech>2018-12-03 14:41:52 +0000
commit9104eb39d56848952e68d660bdc3cc7500789501 (patch)
tree66ac25de7e95dfbc9ab9b3f0b1a41a57bb18d48f /services
parentfb7c89ebe2e682170b09275a5e531d0a49d70ada (diff)
Fix checkstyle/sonar issues
Remove unused imports Add @FunctionalInterface annotation Reduce the complexity of some methods Change-Id: If519c31b113233361fbb935121fe6494263ac957 Issue-ID: POLICY-1074 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'services')
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java54
1 files changed, 30 insertions, 24 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java
index c39be64fc..08c0e6910 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java
@@ -127,30 +127,7 @@ public class ApexActivator {
unmarshaller.init(engineServiceHandler);
}
- // Set up unmarshaler/marshaler pairing for synchronized event handling. We only need to
- // traverse the unmarshalers because the
- // unmarshalers and marshalers are paired one to one uniquely so if we find a
- // synchronized unmarshaler we'll also find its
- // paired marshaler
- for (final Entry<String, EventHandlerParameters> inputParameters : apexParameters.getEventInputParameters()
- .entrySet()) {
- final ApexEventUnmarshaller unmarshaller = unmarshallerMap.get(inputParameters.getKey());
-
- // Pair up peered unmarshalers and marshalers
- for (final EventHandlerPeeredMode peeredMode : EventHandlerPeeredMode.values()) {
- // Check if the unmarshaler is synchronized with a marshaler
- if (inputParameters.getValue().isPeeredMode(peeredMode)) {
- // Find the unmarshaler and marshaler
- final ApexEventMarshaller peeredMarshaler =
- marshallerMap.get(inputParameters.getValue().getPeer(peeredMode));
-
- // Connect the unmarshaler and marshaler
- unmarshaller.connectMarshaler(peeredMode, peeredMarshaler);
- }
- }
- // Now let's get events flowing
- unmarshaller.start();
- }
+ setUpmarshalerPairings();
} catch (final Exception e) {
LOGGER.debug("Apex engine failed to start as a service", e);
throw new ApexActivatorException("Apex engine failed to start as a service", e);
@@ -160,6 +137,35 @@ public class ApexActivator {
}
/**
+ * Set up unmarshaler/marshaler pairing for synchronized event handling. We only need to
+ * traverse the unmarshalers because the
+ * unmarshalers and marshalers are paired one to one uniquely so if we find a
+ * synchronized unmarshaler we'll also find its
+ * paired marshaler
+ */
+ private void setUpmarshalerPairings() {
+ for (final Entry<String, EventHandlerParameters> inputParameters : apexParameters.getEventInputParameters()
+ .entrySet()) {
+ final ApexEventUnmarshaller unmarshaller = unmarshallerMap.get(inputParameters.getKey());
+
+ // Pair up peered unmarshalers and marshalers
+ for (final EventHandlerPeeredMode peeredMode : EventHandlerPeeredMode.values()) {
+ // Check if the unmarshaler is synchronized with a marshaler
+ if (inputParameters.getValue().isPeeredMode(peeredMode)) {
+ // Find the unmarshaler and marshaler
+ final ApexEventMarshaller peeredMarshaler =
+ marshallerMap.get(inputParameters.getValue().getPeer(peeredMode));
+
+ // Connect the unmarshaler and marshaler
+ unmarshaller.connectMarshaler(peeredMode, peeredMarshaler);
+ }
+ }
+ // Now let's get events flowing
+ unmarshaller.start();
+ }
+ }
+
+ /**
* Terminate the Apex engine.
*
* @throws ApexException on termination errors