diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml
index b5e7141461..5cb57f3dfb 100644
--- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml
+++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/pom.xml
@@ -59,6 +59,7 @@
javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional,
org.wso2.carbon.context,
org.wso2.carbon.utils.*,
+ org.wso2.carbon.ndatasource.core,
org.w3c.dom,
org.apache.velocity;version="${velocity.version}",
org.apache.velocity.app;version="${velocity.version}",
@@ -168,6 +169,16 @@
org.wso2.carbon.devicemgt
org.wso2.carbon.device.mgt.common
+
+ org.wso2.carbon
+ org.wso2.carbon.ndatasource.core
+
+
+ log4j
+ log4j
+
+
+
diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/HeartBeatBeaconUtils.java b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/HeartBeatBeaconUtils.java
index 8d9a69f703..9c5b91a93d 100644
--- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/HeartBeatBeaconUtils.java
+++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/HeartBeatBeaconUtils.java
@@ -30,7 +30,6 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.net.InetAddress;
-import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Hashtable;
@@ -68,7 +67,7 @@ public class HeartBeatBeaconUtils {
return (DataSource) InitialContext.doLookup(dataSourceName);
}
final InitialContext context = new InitialContext(jndiProperties);
- return (DataSource) context.lookup(dataSourceName);
+ return (DataSource) context.doLookup(dataSourceName);
} catch (Exception e) {
throw new RuntimeException("Error in looking up data source: " + e.getMessage(), e);
}
@@ -77,20 +76,10 @@ public class HeartBeatBeaconUtils {
public static ServerContext getServerDetails() throws UnknownHostException, SocketException {
InetAddress localHost = InetAddress.getLocalHost();
- NetworkInterface ni = NetworkInterface.getByInetAddress(localHost);
- byte[] hardwareAddress = ni.getHardwareAddress();
- String[] hexadecimal = new String[hardwareAddress.length];
- for (int i = 0; i < hardwareAddress.length; i++) {
- hexadecimal[i] = String.format("%02X", hardwareAddress[i]);
- }
- String macAddress = String.join("-", hexadecimal);
int iotsCorePort = Integer.parseInt(System.getProperty("iot.core.https.port"));
-
ServerContext ctx = new ServerContext();
ctx.setHostName(localHost.getHostName());
- ctx.setMacAddress(macAddress);
ctx.setCarbonServerPort(iotsCorePort);
-
return ctx;
}
diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java
index 7c1365a9d6..e2bb9e2fec 100644
--- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java
+++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java
@@ -35,6 +35,7 @@ import java.io.File;
@XmlRootElement(name = "HeartBeatBeaconConfig")
public class HeartBeatBeaconConfig {
+ private boolean enabled;
private int notifierFrequency;
private int notifierDelay;
private int serverTimeOutIntervalInSeconds;
@@ -44,7 +45,7 @@ public class HeartBeatBeaconConfig {
private static HeartBeatBeaconConfig config;
private static final String HEART_BEAT_NOTIFIER_CONFIG_PATH =
- CarbonUtils.getEtcCarbonConfigDirPath() + File.separator + "heart-beat-config.xml";
+ CarbonUtils.getCarbonConfigDirPath() + File.separator + "heart-beat-config.xml";
private HeartBeatBeaconConfig() {
}
@@ -102,6 +103,15 @@ public class HeartBeatBeaconConfig {
this.dataSourceConfig = dataSourceConfig;
}
+ @XmlElement(name = "Enable", required = true)
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
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/dao/HeartBeatBeaconDAOFactory.java b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dao/HeartBeatBeaconDAOFactory.java
index 97e1c3428b..e8d3011be9 100644
--- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dao/HeartBeatBeaconDAOFactory.java
+++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dao/HeartBeatBeaconDAOFactory.java
@@ -167,7 +167,6 @@ public class HeartBeatBeaconDAOFactory {
currentConnection.remove();
}
-
/**
* Resolve data source from the data source definition
*
@@ -190,7 +189,7 @@ public class HeartBeatBeaconDAOFactory {
List jndiPropertyList =
jndiConfig.getJndiProperties();
if (jndiPropertyList != null) {
- Hashtable