Fixing issues with DS initialization

revert-70ac1926
Ace 4 years ago
parent 5ca299530e
commit c1652b61f8

@ -18,6 +18,7 @@
package io.entgra.server.bootup.heartbeat.beacon; 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 io.entgra.server.bootup.heartbeat.beacon.exception.InvalidConfigurationStateException;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.CarbonUtils;
@ -36,6 +37,7 @@ public class HeartBeatBeaconConfig {
private int notifierDelay; private int notifierDelay;
private int serverTimeOutIntervalInSeconds; private int serverTimeOutIntervalInSeconds;
private int timeSkew; private int timeSkew;
private DataSourceConfig dataSourceConfig;
private static HeartBeatBeaconConfig config; private static HeartBeatBeaconConfig config;
@ -89,6 +91,15 @@ public class HeartBeatBeaconConfig {
this.serverTimeOutIntervalInSeconds = serverTimeOutIntervalInSeconds; 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 { public static void init() throws HeartBeatBeaconConfigurationException {
try { try {
File emailSenderConfig = new File(HEART_BEAT_NOTIFIER_CONFIG_PATH); File emailSenderConfig = new File(HEART_BEAT_NOTIFIER_CONFIG_PATH);

@ -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.HeartBeatBeaconConfig;
import io.entgra.server.bootup.heartbeat.beacon.HeartBeatBeaconUtils; 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.HeartBeatManagementService;
import io.entgra.server.bootup.heartbeat.beacon.service.HeartBeatManagementServiceImpl; import io.entgra.server.bootup.heartbeat.beacon.service.HeartBeatManagementServiceImpl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -42,6 +44,8 @@ public class HeartBeatBeaconComponent {
} }
//heart beat notifier configuration */ //heart beat notifier configuration */
HeartBeatBeaconConfig.init(); HeartBeatBeaconConfig.init();
DataSourceConfig dsConfig = HeartBeatBeaconConfig.getInstance().getDataSourceConfig();
HeartBeatBeaconDAOFactory.init(dsConfig);
this.registerHeartBeatServices(componentContext); this.registerHeartBeatServices(componentContext);

Loading…
Cancel
Save