diff options
author | a.sreekumar <ajith.sreekumar@bell.ca> | 2021-12-03 11:27:32 +0000 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@bell.ca> | 2021-12-14 17:58:20 +0000 |
commit | 4694c152f69380f4d3d64bde0a13d15fb59a71f3 (patch) | |
tree | 38c9e0b1117323c58536706a66830109225d6200 /main/src/main/java/org/onap/policy/pap/main/comm/PdpMessageGenerator.java | |
parent | c51fa0d4e953518571a115af4afdea80a17ed605 (diff) |
Migrate pap startup & controllers to spring boot
This commit migrates pap config, startup and controllers to spring boot.
Change-Id: Icf91d728160a23db614dfba6b40ddccd2f6163a5
Issue-ID: POLICY-3754
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'main/src/main/java/org/onap/policy/pap/main/comm/PdpMessageGenerator.java')
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/comm/PdpMessageGenerator.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/comm/PdpMessageGenerator.java b/main/src/main/java/org/onap/policy/pap/main/comm/PdpMessageGenerator.java index 8dad7ac4..02609535 100644 --- a/main/src/main/java/org/onap/policy/pap/main/comm/PdpMessageGenerator.java +++ b/main/src/main/java/org/onap/policy/pap/main/comm/PdpMessageGenerator.java @@ -42,6 +42,8 @@ import org.onap.policy.pap.main.notification.PolicyNotifier; import org.onap.policy.pap.main.parameters.PapParameterGroup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.event.EventListener; /** @@ -52,25 +54,26 @@ public class PdpMessageGenerator { private static final String PAP_GROUP_PARAMS_NAME = "PapGroup"; + private boolean includeHeartBeat; /** * Lock used when updating PDPs. */ - protected final Object updateLock; + protected Object updateLock; /** * Used to send UPDATE and STATE-CHANGE requests to the PDPs. */ - protected final PdpModifyRequestMap requestMap; + protected PdpModifyRequestMap requestMap; /** * Factory for PAP DAO. */ - protected final PolicyModelsProviderFactoryWrapper modelProviderWrapper; + protected PolicyModelsProviderFactoryWrapper modelProviderWrapper; /** * Heart beat interval, in milliseconds, to pass to PDPs, or {@code null}. */ - private final Long heartBeatMs; + private Long heartBeatMs; /** * Constructs the object. @@ -79,6 +82,14 @@ public class PdpMessageGenerator { * PDP-UPDATE messages */ public PdpMessageGenerator(boolean includeHeartBeat) { + this.includeHeartBeat = includeHeartBeat; + } + + /** + * Initialize the parameters. + */ + @EventListener(ApplicationReadyEvent.class) + public void initialize() { modelProviderWrapper = Registry.get(PapConstants.REG_PAP_DAO_FACTORY, PolicyModelsProviderFactoryWrapper.class); updateLock = Registry.get(PapConstants.REG_PDP_MODIFY_LOCK, Object.class); requestMap = Registry.get(PapConstants.REG_PDP_MODIFY_MAP, PdpModifyRequestMap.class); |