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/config/HeartBeatBeaconConfig.java
similarity index 90%
rename from components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/HeartBeatBeaconConfig.java
rename to components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/config/HeartBeatBeaconConfig.java
index 1d3efd95fd2..7c1365a9d63 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/config/HeartBeatBeaconConfig.java
@@ -16,8 +16,10 @@
* under the License.
*/
-package io.entgra.server.bootup.heartbeat.beacon;
+package io.entgra.server.bootup.heartbeat.beacon.config;
+import io.entgra.server.bootup.heartbeat.beacon.HeartBeatBeaconConfigurationException;
+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.exception.InvalidConfigurationStateException;
import org.w3c.dom.Document;
@@ -55,7 +57,7 @@ public class HeartBeatBeaconConfig {
return config;
}
- @XmlElement(name = "NotifierInitialDelay", required = true)
+ @XmlElement(name = "NotifierInitialDelayInSeconds", required = true)
public int getNotifierDelay() {
return notifierDelay;
}
@@ -64,7 +66,7 @@ public class HeartBeatBeaconConfig {
this.notifierDelay = notifierDelay;
}
- @XmlElement(name = "NotifierFrequency", required = true)
+ @XmlElement(name = "NotifierFrequencyInSeconds", required = true)
public int getNotifierFrequency() {
return notifierFrequency;
}
@@ -73,7 +75,7 @@ public class HeartBeatBeaconConfig {
this.notifierFrequency = notifierFrequency;
}
- @XmlElement(name = "timeSkew", required = true)
+ @XmlElement(name = "TimeSkewInSeconds", required = true)
public int getTimeSkew() {
return timeSkew;
}
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 524814da8f4..7cc795d4a6e 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
@@ -18,7 +18,7 @@
package io.entgra.server.bootup.heartbeat.beacon.internal;
-import io.entgra.server.bootup.heartbeat.beacon.HeartBeatBeaconConfig;
+import io.entgra.server.bootup.heartbeat.beacon.config.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;
diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/internal/HeartBeatInternalUtils.java b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/internal/HeartBeatInternalUtils.java
index 401483135f0..1e5debde743 100644
--- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/internal/HeartBeatInternalUtils.java
+++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/internal/HeartBeatInternalUtils.java
@@ -18,7 +18,7 @@
package io.entgra.server.bootup.heartbeat.beacon.internal;
-import io.entgra.server.bootup.heartbeat.beacon.HeartBeatBeaconConfig;
+import io.entgra.server.bootup.heartbeat.beacon.config.HeartBeatBeaconConfig;
import io.entgra.server.bootup.heartbeat.beacon.HeartBeatBeaconConfigurationException;
import io.entgra.server.bootup.heartbeat.beacon.dto.HeartBeatEvent;
import io.entgra.server.bootup.heartbeat.beacon.dto.ServerContext;
diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java
index 87ba57df0eb..576b7c67dfb 100644
--- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java
+++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java
@@ -18,7 +18,7 @@
package io.entgra.server.bootup.heartbeat.beacon.service;
-import io.entgra.server.bootup.heartbeat.beacon.HeartBeatBeaconConfig;
+import io.entgra.server.bootup.heartbeat.beacon.config.HeartBeatBeaconConfig;
import io.entgra.server.bootup.heartbeat.beacon.dao.HeartBeatBeaconDAOFactory;
import io.entgra.server.bootup.heartbeat.beacon.dao.HeartBeatDAO;
import io.entgra.server.bootup.heartbeat.beacon.dao.exception.HeartBeatDAOException;
diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml
new file mode 100644
index 00000000000..c1f137a61df
--- /dev/null
+++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/pom.xml
@@ -0,0 +1,191 @@
+
+
+
+
+
+
+ org.wso2.carbon.devicemgt
+ heart-beat-feature
+ 4.1.11-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ io.entgra.server.heart.beat.feature
+ pom
+ Entgra IoT - Heart Beat Feature
+ http://entgra.io
+
+ This feature bundles for the heart beat beacon for Entgra IoT Server
+
+
+
+
+ com.h2database.wso2
+ h2-database-engine
+
+
+ org.wso2.carbon.devicemgt
+ io.entgra.server.bootup.heartbeat.beacon
+
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.device.mgt.common
+ provided
+
+
+ org.wso2.carbon.identity.inbound.auth.oauth2
+ org.wso2.carbon.identity.oauth.stub
+
+
+ org.apache.axis2.wso2
+ axis2-client
+
+
+ org.apache.geronimo.specs.wso2
+ geronimo-stax-api_1.0_spec
+
+
+ org.apache.ws.commons.axiom.wso2
+ axiom
+
+
+ org.codehaus.woodstox
+ woodstox-core-asl
+
+
+ org.codehaus.woodstox
+ wstx-asl
+
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.device.mgt.analytics.data.publisher
+
+
+ org.wso2.carbon.analytics
+ org.wso2.carbon.analytics.api
+
+
+
+
+
+
+
+
+ maven-resources-plugin
+ 2.6
+
+
+ copy-resources
+ generate-resources
+
+ copy-resources
+
+
+ src/main/resources
+
+
+ resources
+
+ build.properties
+ p2.inf
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+
+ create-heart-beat-mgt-schema
+ package
+
+ run
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.wso2.maven
+ carbon-p2-plugin
+ ${carbon.p2.plugin.version}
+
+
+ p2-feature-generation
+ package
+
+ p2-feature-gen
+
+
+ io.entgra.server.heart.beat
+ ../../../../features/etc/feature.properties
+
+
+
+ org.wso2.carbon.p2.category.type:server
+
+ org.eclipse.equinox.p2.type.group:true
+
+
+
+
+
+ org.wso2.carbon.devicemgt:io.entgra.server.bootup.heartbeat.beacon:${carbon.device.mgt.version}
+
+
+
+ org.wso2.carbon.core.server:${carbon.kernel.version}
+
+
+
+
+
+
+
+
diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/build.properties b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/build.properties
new file mode 100644
index 00000000000..9404b75803d
--- /dev/null
+++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/build.properties
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2018 - 2020 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
+#
+# Unauthorised copying/redistribution of this file, via any medium is strictly prohibited.
+#
+# Licensed under the Entgra Commercial License, Version 1.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://entgra.io/licenses/entgra-commercial/1.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+jarProcessor.unsign=true
+signJars=true
+custom = true
diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml
new file mode 100644
index 00000000000..f025df04785
--- /dev/null
+++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/conf/heart-beat-config.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ jdbc/ServerHeartBeat_DS
+
+
+ 30
+ 300
+ 5
+ 600
+
diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/datasources/heart-beat-datasources.xml b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/datasources/heart-beat-datasources.xml
new file mode 100644
index 00000000000..34c5d011b5d
--- /dev/null
+++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/datasources/heart-beat-datasources.xml
@@ -0,0 +1,48 @@
+
+
+
+
+ org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader
+
+
+
+
+ jdbc/ServerHeartBeat_DS
+ The datasource used for recording server Heart Beats
+
+ jdbc/ServerHeartBeat_DS
+
+
+
+ jdbc:h2:repository/database/HeartBeat_DB;DB_CLOSE_ON_EXIT=FALSE
+ wso2carbon
+ wso2carbon
+ org.h2.Driver
+ 50
+ 60000
+ true
+ SELECT 1
+ 30000
+
+
+
+
+
+
diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/h2.sql b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/h2.sql
new file mode 100644
index 00000000000..570c2f78df2
--- /dev/null
+++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/h2.sql
@@ -0,0 +1,12 @@
+-- -----------------------------------------------------
+-- Table `SERVER_HEART_BEAT_EVENTS`
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS SERVER_HEART_BEAT_EVENTS (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ HOST_NAME VARCHAR(100) NOT NULL,
+ MAC VARCHAR(100) NOT NULL,
+ UUID VARCHAR(100) NOT NULL,
+ SERVER_PORT INTEGER NOT NULL,
+ LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (ID)
+);
diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/mssql.sql b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/mssql.sql
new file mode 100644
index 00000000000..830aaea26aa
--- /dev/null
+++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/mssql.sql
@@ -0,0 +1,15 @@
+-- -----------------------------------------------------
+-- Table `SERVER_HEART_BEAT_EVENTS`
+-- -----------------------------------------------------
+
+IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[SERVER_HEART_BEAT_EVENTS]') AND TYPE IN (N'U'))
+CREATE TABLE SERVER_HEART_BEAT_EVENTS (
+ ID INT NOT NULL AUTO_INCREMENT,
+ HOST_NAME VARCHAR(100) NOT NULL,
+ MAC VARCHAR(100) NOT NULL,
+ UUID VARCHAR(100) NOT NULL,
+ SERVER_PORT INT NOT NULL,
+ LAST_UPDATED_TIMESTAMP DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (ID));
+
+
diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/mysql.sql b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/mysql.sql
new file mode 100644
index 00000000000..4584426b5c7
--- /dev/null
+++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/mysql.sql
@@ -0,0 +1,12 @@
+-- -----------------------------------------------------
+-- Table `POWER_METER_DEVICE`
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS SERVER_HEART_BEAT_EVENTS (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ HOST_NAME VARCHAR(100) NOT NULL,
+ MAC VARCHAR(100) NOT NULL,
+ UUID VARCHAR(100) NOT NULL,
+ SERVER_PORT INTEGER NOT NULL,
+ LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (ID)
+);
diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/oracle.sql b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/oracle.sql
new file mode 100644
index 00000000000..81ed4cfaadb
--- /dev/null
+++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/oracle.sql
@@ -0,0 +1,14 @@
+-- -----------------------------------------------------
+-- Table `SERVER_HEART_BEAT_EVENTS`
+-- -----------------------------------------------------
+
+CREATE TABLE SERVER_HEART_BEAT_EVENTS (
+ ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL,
+ HOST_NAME VARCHAR(100) NOT NULL,
+ MAC VARCHAR(100) NOT NULL,
+ UUID VARCHAR(100) NOT NULL,
+ SERVER_PORT INTEGER NOT NULL,
+ LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ CONSTRAINT PK_POWER_METER_DEVICE PRIMARY KEY (ID)
+)
+/
diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/postgresql.sql b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/postgresql.sql
new file mode 100644
index 00000000000..989ed77954f
--- /dev/null
+++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/dbscripts/heart-beat/postgresql.sql
@@ -0,0 +1,12 @@
+-- -----------------------------------------------------
+-- Table SERVER_HEART_BEAT_EVENTS
+-- -----------------------------------------------------
+ CREATE TABLE IF NOT EXISTS SERVER_HEART_BEAT_EVENTS (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ HOST_NAME VARCHAR(100) NOT NULL,
+ MAC VARCHAR(100) NOT NULL,
+ UUID VARCHAR(100) NOT NULL,
+ SERVER_PORT INTEGER NOT NULL,
+ LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (ID)
+);
diff --git a/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/p2.inf b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/p2.inf
new file mode 100644
index 00000000000..1a0593e92d7
--- /dev/null
+++ b/features/heartbeat-management/io.entgra.server.heart.beat.feature/src/main/resources/p2.inf
@@ -0,0 +1,11 @@
+instructions.configure = \
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/io.entgra.server.heart.beat_${feature.version}/datasources/,target:${installFolder}/../../../conf/datasources/,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/io.entgra.server.heart.beat_${feature.version}/conf/heart-beat-config.xml,target:${installFolder}/../../../conf/heart-beat-config.xml,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/io.entgra.server.heart.beat_${feature.version}/dbscripts/heart-beat/,target:${installFolder}/../../../dbscripts/heart-beat,overwrite:true);\
+org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/database/);\
+org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/io.entgra.server.heart.beat_${feature.version}/database/,target:${installFolder}/../../../repository/database/,overwrite:true);\
+
+instructions.unconfigure = \
+org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../conf/datasources/heart-beat-datasources.xml);\
+org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/heart-beat);\
+org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/HeartBeat_DB.h2.db);\
diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml
new file mode 100644
index 00000000000..049bf35a50f
--- /dev/null
+++ b/features/heartbeat-management/pom.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ org.wso2.carbon.devicemgt
+ carbon-devicemgt
+ 4.1.11-SNAPSHOT
+ ../../pom.xml
+
+
+ 4.0.0
+ org.wso2.carbon.devicemgt
+ heart-beat-feature
+ 4.1.11-SNAPSHOT
+ pom
+ Entgra - Heart Beat Feature
+ http://wso2.org
+
+
+ io.entgra.server.heart.beat.feature
+
+
+
diff --git a/pom.xml b/pom.xml
index 6218cb046e8..3b8e07f718a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,6 +54,7 @@
features/certificate-mgt
features/oauth-extensions
features/email-sender
+ features/heartbeat-management
features/ui-request-interceptor
features/jwt-client
features/device-mgt-extensions