diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/HeartBeatBeaconConfig.java b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/HeartBeatBeaconConfig.java index f8b741fec39..1d3efd95fd2 100644 --- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/HeartBeatBeaconConfig.java +++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/HeartBeatBeaconConfig.java @@ -18,6 +18,7 @@ package io.entgra.server.bootup.heartbeat.beacon; +import io.entgra.server.bootup.heartbeat.beacon.config.datasource.DataSourceConfig; import io.entgra.server.bootup.heartbeat.beacon.exception.InvalidConfigurationStateException; import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; @@ -36,6 +37,7 @@ public class HeartBeatBeaconConfig { private int notifierDelay; private int serverTimeOutIntervalInSeconds; private int timeSkew; + private DataSourceConfig dataSourceConfig; private static HeartBeatBeaconConfig config; @@ -89,6 +91,15 @@ public class HeartBeatBeaconConfig { this.serverTimeOutIntervalInSeconds = serverTimeOutIntervalInSeconds; } + @XmlElement(name = "DataSourceConfiguration", required = true) + public DataSourceConfig getDataSourceConfig() { + return dataSourceConfig; + } + + public void setDataSourceConfig(DataSourceConfig dataSourceConfig) { + this.dataSourceConfig = dataSourceConfig; + } + public static void init() throws HeartBeatBeaconConfigurationException { try { File emailSenderConfig = new File(HEART_BEAT_NOTIFIER_CONFIG_PATH); diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java index 6d522910b88..524814da8f4 100644 --- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java +++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java @@ -20,6 +20,8 @@ package io.entgra.server.bootup.heartbeat.beacon.internal; import io.entgra.server.bootup.heartbeat.beacon.HeartBeatBeaconConfig; import io.entgra.server.bootup.heartbeat.beacon.HeartBeatBeaconUtils; +import io.entgra.server.bootup.heartbeat.beacon.config.datasource.DataSourceConfig; +import io.entgra.server.bootup.heartbeat.beacon.dao.HeartBeatBeaconDAOFactory; import io.entgra.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; import io.entgra.server.bootup.heartbeat.beacon.service.HeartBeatManagementServiceImpl; import org.apache.commons.logging.Log; @@ -42,6 +44,8 @@ public class HeartBeatBeaconComponent { } //heart beat notifier configuration */ HeartBeatBeaconConfig.init(); + DataSourceConfig dsConfig = HeartBeatBeaconConfig.getInstance().getDataSourceConfig(); + HeartBeatBeaconDAOFactory.init(dsConfig); this.registerHeartBeatServices(componentContext);