diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api/pom.xml
index a4c2ac4585..564673ef8b 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.api/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
grafana-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.common/pom.xml
index d9627dd4c6..1ba9a75dd3 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.common/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.common/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
grafana-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.core/pom.xml
index 1023761e3d..56aacfa64d 100644
--- a/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.core/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/io.entgra.analytics.mgt.grafana.proxy.core/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
grafana-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml
index 5e099a5446..e48aeca1f7 100644
--- a/components/analytics-mgt/grafana-mgt/pom.xml
+++ b/components/analytics-mgt/grafana-mgt/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
analytics-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml
index 226f71a281..ded09a6876 100644
--- a/components/analytics-mgt/pom.xml
+++ b/components/analytics-mgt/pom.xml
@@ -3,7 +3,7 @@
carbon-devicemgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../../pom.xml
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml
index a2e6d02ffd..0918920bdc 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml
index 3f29d8f5db..a064c551c1 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml
@@ -21,7 +21,7 @@
apimgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml
index 1db14c86db..9ebf10c38f 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.keymgt.extension.api/pom.xml
index 97835e7c80..95be718e7a 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.keymgt.extension.api/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.keymgt.extension.api/pom.xml
@@ -3,7 +3,7 @@
apimgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
4.0.0
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.keymgt.extension/pom.xml
index f748dad9a9..6c7db5b264 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.keymgt.extension/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.keymgt.extension/pom.xml
@@ -3,7 +3,7 @@
apimgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml
index 24fa878e3b..81aea0503d 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml
@@ -22,7 +22,7 @@
apimgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml
index daf70f8841..a2c8ece854 100644
--- a/components/apimgt-extensions/pom.xml
+++ b/components/apimgt-extensions/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../../pom.xml
diff --git a/components/application-mgt/io.entgra.application.mgt.addons/pom.xml b/components/application-mgt/io.entgra.application.mgt.addons/pom.xml
index ef34a74787..a67eb8592f 100644
--- a/components/application-mgt/io.entgra.application.mgt.addons/pom.xml
+++ b/components/application-mgt/io.entgra.application.mgt.addons/pom.xml
@@ -20,7 +20,7 @@
application-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/io.entgra.application.mgt.api/pom.xml b/components/application-mgt/io.entgra.application.mgt.api/pom.xml
index 5b4ce2177a..4f42850568 100644
--- a/components/application-mgt/io.entgra.application.mgt.api/pom.xml
+++ b/components/application-mgt/io.entgra.application.mgt.api/pom.xml
@@ -22,7 +22,7 @@
application-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/io.entgra.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.application.mgt.common/pom.xml
index 729c04a0ea..2e058b82dd 100644
--- a/components/application-mgt/io.entgra.application.mgt.common/pom.xml
+++ b/components/application-mgt/io.entgra.application.mgt.common/pom.xml
@@ -21,7 +21,7 @@
org.wso2.carbon.devicemgt
application-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/io.entgra.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.application.mgt.core/pom.xml
index a888a0bdf4..e93b704269 100644
--- a/components/application-mgt/io.entgra.application.mgt.core/pom.xml
+++ b/components/application-mgt/io.entgra.application.mgt.core/pom.xml
@@ -21,7 +21,7 @@
org.wso2.carbon.devicemgt
application-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java
index 9ad0b9d4c0..bfce4e31fa 100644
--- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java
+++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java
@@ -94,6 +94,7 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl {
|| StringUtils.isNotEmpty(filter.getAppReleaseType())) {
sql += "LEFT JOIN AP_APP_RELEASE ON AP_APP.ID = AP_APP_RELEASE.AP_APP_ID ";
}
+ sql += "WHERE AP_APP.TENANT_ID = ? ";
if (StringUtils.isNotEmpty(filter.getAppType()) && !Constants.ALL.equalsIgnoreCase(filter.getAppType())) {
sql += "AND AP_APP.TYPE = ? ";
}
@@ -128,7 +129,7 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl {
sql += filter.getSortBy() +" ";
}
if (filter.getLimit() != -1) {
- sql += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY ";
+ sql += "OFFSET ? ROWS FETCH NEXT ? ROWS ONLY ";
}
sql += ") AS app_data ON app_data.ID = AP_APP.ID "
+ "LEFT JOIN ("
@@ -145,6 +146,7 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl {
Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
int paramIndex = 1;
+ stmt.setInt(paramIndex++, tenantId);
if (StringUtils.isNotEmpty(filter.getAppType()) && !Constants.ALL.equalsIgnoreCase(filter.getAppType())) {
stmt.setString(paramIndex++, filter.getAppType());
}
diff --git a/components/application-mgt/io.entgra.application.mgt.publisher.api/pom.xml b/components/application-mgt/io.entgra.application.mgt.publisher.api/pom.xml
index 8883120c43..adddc4026a 100644
--- a/components/application-mgt/io.entgra.application.mgt.publisher.api/pom.xml
+++ b/components/application-mgt/io.entgra.application.mgt.publisher.api/pom.xml
@@ -22,7 +22,7 @@
application-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/pom.xml b/components/application-mgt/io.entgra.application.mgt.store.api/pom.xml
index 8d638df716..ff4e816abc 100644
--- a/components/application-mgt/io.entgra.application.mgt.store.api/pom.xml
+++ b/components/application-mgt/io.entgra.application.mgt.store.api/pom.xml
@@ -22,7 +22,7 @@
application-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml
index 0ead8b8a9b..dfb1d48017 100644
--- a/components/application-mgt/pom.xml
+++ b/components/application-mgt/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../../pom.xml
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml
index 9713c4ea12..f70a1fa72c 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml
@@ -22,7 +22,7 @@
certificate-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml
index 7c18184715..a5a16ab3c6 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml
@@ -22,7 +22,7 @@
certificate-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml
index 0e9b4a4ed8..fdd5660b81 100644
--- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml
+++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml
@@ -38,7 +38,7 @@
org.wso2.carbon.devicemgt
certificate-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml
index 941d82d456..99af2f9561 100644
--- a/components/certificate-mgt/pom.xml
+++ b/components/certificate-mgt/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.extensions.defaultrole.manager/pom.xml
index 50d7f13304..e36b58f55e 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.extensions.defaultrole.manager/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.extensions.defaultrole.manager/pom.xml
@@ -23,7 +23,7 @@
device-mgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.extensions.logger/pom.xml
index 7584058970..475c8b4e6e 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.extensions.logger/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.extensions.logger/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.extensions.stateengine/pom.xml
index e618a386bd..229e8d6e3e 100644
--- a/components/device-mgt-extensions/io.entgra.device.mgt.extensions.stateengine/pom.xml
+++ b/components/device-mgt-extensions/io.entgra.device.mgt.extensions.stateengine/pom.xml
@@ -23,7 +23,7 @@
device-mgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml
index 899044e147..9a11f603e7 100644
--- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml
+++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml
index b9534c9c9c..7625a603b3 100644
--- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml
+++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml
index adcb08c877..ec894c7900 100644
--- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml
+++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml
index 204498ea3c..2e107b2543 100644
--- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml
+++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
index ec4d7cb47b..1cde061ac1 100644
--- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
+++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
index f80fcbeb1e..3fdd250307 100644
--- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
+++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml
@@ -22,7 +22,7 @@
device-mgt-extensions
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml
index fec507492f..d141f2ff6f 100644
--- a/components/device-mgt-extensions/pom.xml
+++ b/components/device-mgt-extensions/pom.xml
@@ -22,7 +22,7 @@
carbon-devicemgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../../pom.xml
diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml
index 95bb7c668b..2c0ea76ceb 100644
--- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml
+++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/pom.xml
@@ -22,7 +22,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml
index b49c7a0299..aca43d379e 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml
@@ -22,7 +22,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml
index 3b686fe6e3..1abb0dca0c 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml
@@ -21,7 +21,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml
index ef94adce4a..a55ae5faff 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
device-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
@@ -103,6 +103,7 @@
org.wso2.carbon.ndatasource.core,
org.wso2.carbon.ntask.core.*,
org.wso2.carbon.ntask.common,
+ io.entgra.task.mgt.common.*,
org.apache.commons.collections;version="${commons-collections.version.range}",
org.wso2.carbon.email.sender.*,
io.swagger.annotations.*;resolution:=optional,
@@ -347,6 +348,10 @@
okhttp
compile
+
+ org.wso2.carbon.devicemgt
+ io.entgra.task.mgt.common
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java
index 585074894d..b293798ba2 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java
@@ -409,7 +409,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager {
}
if (!HttpReportingUtil.isTrackerEnabled()) {
if (log.isDebugEnabled()) {
- log.info("Traccar is disabled");
+ log.debug("Traccar is disabled");
}
}
}
@@ -473,7 +473,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager {
}
if (!HttpReportingUtil.isTrackerEnabled()) {
if (log.isDebugEnabled()) {
- log.info("Traccar is disabled");
+ log.debug("Traccar is disabled");
}
}
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java
index 2ee7e32032..c1bd71a2a5 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java
@@ -32,31 +32,10 @@ import org.wso2.carbon.device.mgt.core.task.impl.DynamicPartitionedScheduleTask;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
public class OperationTimeoutTask extends DynamicPartitionedScheduleTask {
private static final Log log = LogFactory.getLog(OperationTimeoutTask.class);
- private OperationTimeout operationTimeoutConfig;
-
- @Override
- public void setProperties(Map properties) {
- super.setProperties(properties);
- String operationTimeoutTaskConfigStr = properties
- .get(OperationTimeoutTaskManagerServiceImpl.OPERATION_TIMEOUT_TASK_CONFIG);
- Gson gson = new Gson();
- operationTimeoutConfig = gson.fromJson(operationTimeoutTaskConfigStr, OperationTimeout.class);
- }
-
- @Override
- public String getProperty(String name) {
- return super.getProperty(name);
- }
-
- @Override
- public void refreshContext() {
- super.refreshContext();
- }
@Override
protected void setup() {
@@ -65,12 +44,15 @@ public class OperationTimeoutTask extends DynamicPartitionedScheduleTask {
@Override
protected void executeDynamicTask() {
+ String operationTimeoutTaskConfigStr = getProperty(
+ OperationTimeoutTaskManagerServiceImpl.OPERATION_TIMEOUT_TASK_CONFIG);
+ Gson gson = new Gson();
+ OperationTimeout operationTimeoutConfig = gson.fromJson(operationTimeoutTaskConfigStr, OperationTimeout.class);
try {
-
long timeMillis = System.currentTimeMillis() - operationTimeoutConfig.getTimeout() * 60 * 1000;
List deviceTypes = new ArrayList<>();
if (operationTimeoutConfig.getDeviceTypes().size() == 1 &&
- "ALL".equals(operationTimeoutConfig.getDeviceTypes().get( 0))) {
+ "ALL".equals(operationTimeoutConfig.getDeviceTypes().get(0))) {
try {
List deviceTypeList = DeviceManagementDataHolder.getInstance()
.getDeviceManagementProvider().getDeviceTypes();
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
index 7bb7e7c627..9b28775687 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java
@@ -444,7 +444,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
//Exception was not thrown due to being conflicted with non-traccar features
}
} else {
- log.info("Traccar is disabled");
+ if (log.isDebugEnabled()) {
+ log.debug("Traccar is disabled");
+ }
}
//enroll Traccar device
@@ -544,7 +546,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
//Exception was not thrown due to being conflicted with non-traccar features
}
} else {
- log.info("Traccar is disabled");
+ if (log.isDebugEnabled()) {
+ log.debug("Traccar is disabled");
+ }
}
//enroll Traccar device
return status;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java
index 5182fc3651..9d2e1ee7ce 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java
@@ -37,7 +37,6 @@ import org.wso2.carbon.device.mgt.core.task.impl.DynamicPartitionedScheduleTask;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
/**
* This implements the Task service which monitors the device activity periodically & update the device-status if
@@ -47,19 +46,8 @@ public class DeviceStatusMonitoringTask extends DynamicPartitionedScheduleTask {
private static final Log log = LogFactory.getLog(DeviceStatusMonitoringTask.class);
private String deviceType;
- private DeviceStatusTaskPluginConfig deviceStatusTaskPluginConfig;
private int deviceTypeId = -1;
- @Override
- public void setProperties(Map properties) {
- super.setProperties(properties);
- deviceType = properties.get(DeviceStatusTaskManagerServiceImpl.DEVICE_TYPE);
- deviceTypeId = Integer.parseInt(properties.get(DeviceStatusTaskManagerServiceImpl.DEVICE_TYPE_ID));
- String deviceStatusTaskConfigStr = properties.get(DeviceStatusTaskManagerServiceImpl.DEVICE_STATUS_TASK_CONFIG);
- Gson gson = new Gson();
- deviceStatusTaskPluginConfig = gson.fromJson(deviceStatusTaskConfigStr, DeviceStatusTaskPluginConfig.class);
- }
-
@Override
protected void setup() {
}
@@ -92,6 +80,11 @@ public class DeviceStatusMonitoringTask extends DynamicPartitionedScheduleTask {
@Override
public void executeDynamicTask() {
+ deviceType = getProperty(DeviceStatusTaskManagerServiceImpl.DEVICE_TYPE);
+ deviceTypeId = Integer.parseInt(getProperty(DeviceStatusTaskManagerServiceImpl.DEVICE_TYPE_ID));
+ String deviceStatusTaskConfigStr = getProperty(DeviceStatusTaskManagerServiceImpl.DEVICE_STATUS_TASK_CONFIG);
+ Gson gson = new Gson();
+ DeviceStatusTaskPluginConfig deviceStatusTaskPluginConfig = gson.fromJson(deviceStatusTaskConfigStr, DeviceStatusTaskPluginConfig.class);
try {
List enrolmentInfoTobeUpdated = new ArrayList<>();
List allDevicesForMonitoring = getAllDevicesForMonitoring();
@@ -102,10 +95,10 @@ public class DeviceStatusMonitoringTask extends DynamicPartitionedScheduleTask {
EnrolmentInfo enrolmentInfo = monitoringData.getDevice().getEnrolmentInfo();
EnrolmentInfo.Status status = null;
- if (lastUpdatedTime >= this.deviceStatusTaskPluginConfig
+ if (lastUpdatedTime >= deviceStatusTaskPluginConfig
.getIdleTimeToMarkInactive()) {
status = EnrolmentInfo.Status.INACTIVE;
- } else if (lastUpdatedTime >= this.deviceStatusTaskPluginConfig
+ } else if (lastUpdatedTime >= deviceStatusTaskPluginConfig
.getIdleTimeToMarkUnreachable()) {
status = EnrolmentInfo.Status.UNREACHABLE;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java
index 0c6f77c15d..a13031eabb 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java
@@ -48,7 +48,6 @@ import org.wso2.carbon.device.mgt.core.task.DeviceMgtTaskException;
import org.wso2.carbon.device.mgt.core.task.DeviceTaskManager;
import java.util.List;
-import java.util.Map;
public class DeviceDetailsRetrieverTask extends DynamicPartitionedScheduleTask {
@@ -56,14 +55,9 @@ public class DeviceDetailsRetrieverTask extends DynamicPartitionedScheduleTask {
private String deviceType;
private DeviceManagementProviderService deviceManagementProviderService;
- @Override
- public void setProperties(Map map) {
- super.setProperties(map);
- deviceType = map.get("DEVICE_TYPE");
- }
-
@Override
public void executeDynamicTask() {
+ deviceType = getProperty("DEVICE_TYPE");
deviceManagementProviderService = DeviceManagementDataHolder.getInstance()
.getDeviceManagementProvider();
OperationMonitoringTaskConfig operationMonitoringTaskConfig = deviceManagementProviderService
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java
index 0bbb59d2bd..ad3269be00 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java
@@ -19,10 +19,11 @@
package org.wso2.carbon.device.mgt.core.task.impl;
import io.entgra.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException;
+import io.entgra.task.mgt.common.constant.TaskMgtConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.device.mgt.common.ServerCtxInfo;
import org.wso2.carbon.device.mgt.common.DynamicTaskContext;
+import org.wso2.carbon.device.mgt.common.ServerCtxInfo;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.ntask.core.Task;
@@ -37,11 +38,11 @@ public abstract class DynamicPartitionedScheduleTask implements Task {
private Map properties;
@Override
- public void setProperties(Map properties) {
+ public final void setProperties(Map properties) {
this.properties = properties;
}
- public String getProperty(String name) {
+ public final String getProperty(String name) {
if (properties == null) {
return null;
}
@@ -62,7 +63,7 @@ public abstract class DynamicPartitionedScheduleTask implements Task {
}
}
} catch (HeartBeatManagementException e) {
- log.error("Error Instantiating Variables necessary for Dynamic Task Scheduling. Dynamic Tasks will not function." , e);
+ log.error("Error Instantiating Variables necessary for Dynamic Task Scheduling. Dynamic Tasks will not function.", e);
}
setup();
}
@@ -70,11 +71,41 @@ public abstract class DynamicPartitionedScheduleTask implements Task {
@Override
public final void execute() {
refreshContext();
- executeDynamicTask();
+ if (taskContext != null && taskContext.isPartitioningEnabled()) {
+ String localHashIndex = getProperty(TaskMgtConstants.Task.LOCAL_HASH_INDEX);
+ // These tasks are not dynamically scheduled. They are added via a config so scheduled in each node
+ // during the server startup
+ if (localHashIndex == null ) {
+ if (log.isDebugEnabled()) {
+ log.debug("Executing startup scheduled task (" + getTaskName() + ") with class: " +
+ this.getClass().getName());
+ }
+ executeDynamicTask();
+ return;
+ }
+ if (localHashIndex.equals(String.valueOf(taskContext.getServerHashIndex()))) {
+ if (log.isDebugEnabled()) {
+ log.debug("Executing dynamically scheduled task (" + getTaskName() +
+ ") for current server hash index: " + localHashIndex);
+ }
+ executeDynamicTask();
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Ignoring execution of task (" + getTaskName() +
+ ") not belonging to current serer hash index: " + localHashIndex);
+ }
+ }
+ } else {
+ executeDynamicTask();
+ }
+ }
+
+ public String getTaskName() {
+ return getProperty(TaskMgtConstants.Task.LOCAL_TASK_NAME);
}
- public void refreshContext(){
- if(taskContext != null && taskContext.isPartitioningEnabled()) {
+ public void refreshContext() {
+ if (taskContext != null && taskContext.isPartitioningEnabled()) {
try {
updateContext();
} catch (HeartBeatManagementException e) {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml
index a1e6a0b4e4..c359b575ef 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml
@@ -22,7 +22,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml
index 9ba77c4ad9..ce0834d4a7 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml
@@ -23,7 +23,7 @@
device-mgt
org.wso2.carbon.devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml
index 436a192834..d21057f7c5 100644
--- a/components/device-mgt/pom.xml
+++ b/components/device-mgt/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../../pom.xml
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 5a489fb74e..b77baba84f 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
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
heartbeat-management
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dto/ElectedCandidate.java b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dto/ElectedCandidate.java
index a3920d362b..99bfa8eba9 100644
--- a/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dto/ElectedCandidate.java
+++ b/components/heartbeat-management/io.entgra.server.bootup.heartbeat.beacon/src/main/java/io/entgra/server/bootup/heartbeat/beacon/dto/ElectedCandidate.java
@@ -19,13 +19,14 @@
package io.entgra.server.bootup.heartbeat.beacon.dto;
import java.sql.Timestamp;
+import java.util.ArrayList;
import java.util.List;
public class ElectedCandidate {
private String serverUUID;
private Timestamp timeOfElection;
- private List acknowledgedTaskList = null;
+ private List acknowledgedTaskList = new ArrayList<>();
public List getAcknowledgedTaskList() {
return acknowledgedTaskList;
diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml
index 22913f50e2..8a34ff769a 100644
--- a/components/heartbeat-management/pom.xml
+++ b/components/heartbeat-management/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../../pom.xml
diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml
index 700239506b..15ce3a51ca 100644
--- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml
+++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
identity-extensions
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml
index 507cea2e64..7c963d6254 100644
--- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml
+++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
identity-extensions
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml
index 586de2b47c..b1bdcdf8e3 100644
--- a/components/identity-extensions/pom.xml
+++ b/components/identity-extensions/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../../pom.xml
diff --git a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml
index 609d10008f..d8c8483db2 100644
--- a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml
+++ b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml
@@ -3,7 +3,7 @@
org.wso2.carbon.devicemgt
policy-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml
index b02dbd7da2..0dd2f16187 100644
--- a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml
+++ b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml
@@ -3,7 +3,7 @@
org.wso2.carbon.devicemgt
policy-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml
index bca206470b..d13c9bb1ec 100644
--- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml
+++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
policy-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml
index 96a877190f..6991bb4e5f 100644
--- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml
+++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.devicemgt
policy-mgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../pom.xml
diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml
index bf5ec91c3d..2f0a6b7bf6 100644
--- a/components/policy-mgt/pom.xml
+++ b/components/policy-mgt/pom.xml
@@ -23,7 +23,7 @@
org.wso2.carbon.devicemgt
carbon-devicemgt
- 5.0.19-SNAPSHOT
+ 5.0.20-SNAPSHOT
../../pom.xml
diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml
new file mode 100755
index 0000000000..d9ab379c3b
--- /dev/null
+++ b/components/task-mgt/pom.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+ org.wso2.carbon.devicemgt
+ carbon-devicemgt
+ 5.0.20-SNAPSHOT
+ ../../pom.xml
+
+
+ 4.0.0
+ task-mgt
+ pom
+ Entgra IoT - Task Management Component
+ http://entgra.io
+
+
+ task-manager
+ task-watcher
+
+
+
\ No newline at end of file
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.task.mgt.common/pom.xml
new file mode 100755
index 0000000000..ad7c991872
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.common/pom.xml
@@ -0,0 +1,56 @@
+
+
+
+
+ task-manager
+ org.wso2.carbon.devicemgt
+ 5.0.20-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ io.entgra.task.mgt.common
+ bundle
+ Entgra IoT - Task Management Common
+ Entgra IoT - Task Management Common
+ https://entgra.io
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+ ${project.artifactId}
+ ${project.artifactId}
+ ${carbon.device.mgt.version}
+ Task Management Common Bundle
+
+ io.entgra.task.mgt.common.*
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/bean/DynamicTask.java b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/bean/DynamicTask.java
new file mode 100755
index 0000000000..ece8d4dc26
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/bean/DynamicTask.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.common.bean;
+
+import java.util.Map;
+
+public class DynamicTask {
+
+ private int dynamicTaskId;
+ private String name;
+ private String cronExpression;
+ private boolean isEnabled;
+ private int tenantId;
+ private String taskClassName;
+ private Map properties;
+
+ public int getDynamicTaskId() {
+ return dynamicTaskId;
+ }
+
+ public void setDynamicTaskId(int dynamicTaskId) {
+ this.dynamicTaskId = dynamicTaskId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCronExpression() {
+ return cronExpression;
+ }
+
+ public void setCronExpression(String cronExpression) {
+ this.cronExpression = cronExpression;
+ }
+
+ public boolean isEnabled() {
+ return isEnabled;
+ }
+
+ public void setEnabled(boolean enable) {
+ isEnabled = enable;
+ }
+
+ public int getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(int tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public String getTaskClassName() {
+ return taskClassName;
+ }
+
+ public void setTaskClassName(String taskClassName) {
+ this.taskClassName = taskClassName;
+ }
+
+ public Map getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map properties) {
+ this.properties = properties;
+ }
+
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/constant/TaskMgtConstants.java b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/constant/TaskMgtConstants.java
new file mode 100755
index 0000000000..2ffe960964
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/constant/TaskMgtConstants.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.common.constant;
+
+public class TaskMgtConstants {
+ public static final class DataSourceProperties {
+ private DataSourceProperties() {
+ throw new AssertionError();
+ }
+
+ public static final String DB_CHECK_QUERY = "SELECT * FROM DM_DEVICE";
+ public static final String TASK_CONFIG_XML_NAME = "task-mgt-config.xml";
+ }
+
+ public static final class DataBaseTypes {
+ private DataBaseTypes() {
+ throw new AssertionError();
+ }
+
+ public static final String DB_TYPE_MYSQL = "MySQL";
+ public static final String DB_TYPE_ORACLE = "Oracle";
+ public static final String DB_TYPE_MSSQL = "Microsoft SQL Server";
+ public static final String DB_TYPE_DB2 = "DB2";
+ public static final String DB_TYPE_H2 = "H2";
+ public static final String DB_TYPE_POSTGRESQL = "PostgreSQL";
+ }
+
+ public static final class Task {
+
+ public static final String DYNAMIC_TASK_TYPE = "DYNAMIC_TASK";
+ public static final String NAME_SEPARATOR = "_";
+ public static final String PROPERTY_KEY_COLUMN_NAME = "PROPERTY_NAME";
+ public static final String PROPERTY_VALUE_COLUMN_NAME = "PROPERTY_VALUE";
+ public static final String TENANT_ID_PROP = "__TENANT_ID_PROP__";
+ public static final String LOCAL_HASH_INDEX = "__LOCAL_HASH_INDEX__";
+ public static final String LOCAL_TASK_NAME = "__LOCAL_TASK_NAME__";
+ }
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/IllegalTransactionStateException.java b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/IllegalTransactionStateException.java
new file mode 100755
index 0000000000..4c4c996c59
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/IllegalTransactionStateException.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.common.exception;
+
+public class IllegalTransactionStateException extends RuntimeException {
+
+ private static final long serialVersionUID = -3151279331929070297L;
+
+ public IllegalTransactionStateException(String msg, Exception nestedEx) {
+ super(msg, nestedEx);
+ }
+
+ public IllegalTransactionStateException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public IllegalTransactionStateException(String msg) {
+ super(msg);
+ }
+
+ public IllegalTransactionStateException() {
+ super();
+ }
+
+ public IllegalTransactionStateException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TaskManagementDAOException.java b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TaskManagementDAOException.java
new file mode 100755
index 0000000000..9b683dba20
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TaskManagementDAOException.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.common.exception;
+
+public class TaskManagementDAOException extends Exception {
+
+ public TaskManagementDAOException(String msg) {
+ super(msg);
+ }
+
+ public TaskManagementDAOException(String msg, Exception e) {
+ super(msg, e);
+ }
+
+
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TaskManagementException.java b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TaskManagementException.java
new file mode 100755
index 0000000000..d9705e6438
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TaskManagementException.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.common.exception;
+
+public class TaskManagementException extends Exception {
+
+ public TaskManagementException(String msg) {
+ super(msg);
+ }
+
+ public TaskManagementException(String msg, Exception e) {
+ super(msg, e);
+ }
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TaskNotFoundException.java b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TaskNotFoundException.java
new file mode 100755
index 0000000000..2d2f568fe2
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TaskNotFoundException.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.common.exception;
+
+/**
+ * Represents the exception thrown during validating the request.
+ */
+public class TaskNotFoundException extends Exception {
+
+ public TaskNotFoundException(String message) {
+ super(message);
+ }
+
+ public TaskNotFoundException(String message, Exception ex) {
+ super(message, ex);
+ }
+
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TransactionManagementException.java b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TransactionManagementException.java
new file mode 100755
index 0000000000..5e43237e43
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/TransactionManagementException.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.common.exception;
+
+public class TransactionManagementException extends Exception {
+
+ private static final long serialVersionUID = -3151279321929070297L;
+
+ public TransactionManagementException(String msg, Exception nestedEx) {
+ super(msg, nestedEx);
+ }
+
+ public TransactionManagementException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TransactionManagementException(String msg) {
+ super(msg);
+ }
+
+ public TransactionManagementException() {
+ super();
+ }
+
+ public TransactionManagementException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/UnsupportedDatabaseEngineException.java b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/UnsupportedDatabaseEngineException.java
new file mode 100755
index 0000000000..a29f954e12
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/exception/UnsupportedDatabaseEngineException.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.common.exception;
+
+/**
+ * This runtime exception will be thrown if the server has configured with unsupported DB engine.
+ */
+public class UnsupportedDatabaseEngineException extends RuntimeException {
+
+ private static final long serialVersionUID = -3151279311929070297L;
+
+ public UnsupportedDatabaseEngineException(String msg, Exception nestedEx) {
+ super(msg, nestedEx);
+ }
+
+ public UnsupportedDatabaseEngineException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public UnsupportedDatabaseEngineException(String msg) {
+ super(msg);
+ }
+
+ public UnsupportedDatabaseEngineException() {
+ super();
+ }
+
+ public UnsupportedDatabaseEngineException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/spi/TaskManagementService.java b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/spi/TaskManagementService.java
new file mode 100755
index 0000000000..fac557e0bd
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.common/src/main/java/io/entgra/task/mgt/common/spi/TaskManagementService.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.common.spi;
+
+import io.entgra.task.mgt.common.exception.TaskNotFoundException;
+import io.entgra.task.mgt.common.exception.TaskManagementException;
+import io.entgra.task.mgt.common.bean.DynamicTask;
+
+import java.util.List;
+
+public interface TaskManagementService {
+
+ void init() throws TaskManagementException;
+
+ void createTask(DynamicTask dynamicTask) throws TaskManagementException;
+
+ void updateTask(int dynamicTaskId, DynamicTask dynamicTask) throws TaskManagementException, TaskNotFoundException;
+
+ void toggleTask(int dynamicTaskId, boolean isEnabled) throws TaskManagementException, TaskNotFoundException;
+
+ void deleteTask(int dynamicTaskId) throws TaskManagementException, TaskNotFoundException;
+
+ List getAllDynamicTasks() throws TaskManagementException;
+
+ DynamicTask getDynamicTaskById(int dynamicTaskId) throws TaskManagementException;
+
+ List getActiveDynamicTasks() throws TaskManagementException;
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.task.mgt.core/pom.xml
new file mode 100755
index 0000000000..f0ffd6c1f5
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.core/pom.xml
@@ -0,0 +1,141 @@
+
+
+
+
+
+ org.wso2.carbon.devicemgt
+ task-manager
+ 5.0.20-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ io.entgra.task.mgt.core
+ bundle
+ Entgra IoT - Task manager Core
+ Entgra IoT - Task manager Core
+ http://entgra.io
+
+
+
+
+ org.apache.felix
+ maven-scr-plugin
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+ ${project.artifactId}
+ ${project.artifactId}
+ ${carbon.device.mgt.version}
+ Task Management Core Bundle
+ io.entgra.task.mgt.core.internal
+
+ org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
+ org.osgi.service.*;version="${imp.package.version.osgi.service}",
+ org.apache.commons.logging,
+ org.wso2.carbon.ndatasource.core,
+ org.w3c.dom,
+ javax.xml.bind.annotation,
+ javax.xml.bind,
+ javax.sql,
+ javax.naming,
+ io.entgra.task.mgt.common.*,
+ org.wso2.carbon.utils.*,
+ org.wso2.carbon.ntask.core.*,
+ org.wso2.carbon.ntask.common,
+ org.wso2.carbon.device.mgt.common.*,
+ org.wso2.carbon.context,
+ org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}",
+ org.apache.commons.codec.digest;version="${commons-codec.wso2.osgi.version.range}",
+ io.entgra.server.bootup.heartbeat.beacon.dto,
+ io.entgra.server.bootup.heartbeat.beacon.exception,
+ io.entgra.server.bootup.heartbeat.beacon.service,
+
+
+ !io.entgra.task.mgt.core.internal,
+ io.entgra.task.mgt.core.*
+
+
+
+
+
+
+
+
+
+ org.eclipse.osgi
+ org.eclipse.osgi
+ provided
+
+
+ org.eclipse.osgi
+ org.eclipse.osgi.services
+ provided
+
+
+ org.wso2.carbon
+ org.wso2.carbon.ndatasource.core
+ provided
+
+
+ org.wso2.carbon.devicemgt
+ io.entgra.task.mgt.common
+ provided
+
+
+ org.wso2.carbon
+ org.wso2.carbon.logging
+ provided
+
+
+ org.wso2.carbon
+ org.wso2.carbon.utils
+ provided
+
+
+ commons-codec.wso2
+ commons-codec
+ provided
+
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.device.mgt.common
+ provided
+
+
+ org.wso2.carbon.devicemgt
+ io.entgra.server.bootup.heartbeat.beacon
+ provided
+
+
+
+
+ org.wso2.carbon.commons
+ org.wso2.carbon.ntask.core
+ provided
+
+
+
+
\ No newline at end of file
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/TaskConfigurationManager.java b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/TaskConfigurationManager.java
new file mode 100755
index 0000000000..2779a07ff9
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/TaskConfigurationManager.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.core.config;
+
+import io.entgra.task.mgt.common.constant.TaskMgtConstants;
+import io.entgra.task.mgt.common.exception.TaskManagementException;
+import io.entgra.task.mgt.core.util.TaskManagementUtil;
+import org.w3c.dom.Document;
+import org.wso2.carbon.utils.CarbonUtils;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import java.io.File;
+
+/**
+ * Class responsible for the task mgt configuration initialization.
+ */
+public class TaskConfigurationManager {
+
+ private TaskManagementConfig taskManagementConfig;
+ private static volatile TaskConfigurationManager taskConfigurationManager;
+
+ private static final String TASK_MGT_CONFIG_PATH =
+ CarbonUtils.getCarbonConfigDirPath() + File.separator +
+ TaskMgtConstants.DataSourceProperties.TASK_CONFIG_XML_NAME;
+
+ public static TaskConfigurationManager getInstance() {
+ if (taskConfigurationManager == null) {
+ synchronized (TaskConfigurationManager.class) {
+ if (taskConfigurationManager == null) {
+ taskConfigurationManager = new TaskConfigurationManager();
+ }
+ }
+ }
+ return taskConfigurationManager;
+ }
+
+ public synchronized void initConfig() throws TaskManagementException {
+ try {
+ File taskMgtConfig = new File(TASK_MGT_CONFIG_PATH);
+ Document doc = TaskManagementUtil.convertToDocument(taskMgtConfig);
+
+ /* Un-marshaling Device Management configuration */
+ JAXBContext cdmContext = JAXBContext.newInstance(TaskManagementConfig.class);
+ Unmarshaller unmarshaller = cdmContext.createUnmarshaller();
+ //unmarshaller.setSchema(getSchema());
+ this.taskManagementConfig = (TaskManagementConfig) unmarshaller.unmarshal(doc);
+ } catch (JAXBException e) {
+ throw new TaskManagementException("Error occurred while initializing Data Source config", e);
+ }
+ }
+
+ public TaskManagementConfig getTaskManagementConfig() throws TaskManagementException {
+ if (taskManagementConfig == null) {
+ initConfig();
+ }
+ return taskManagementConfig;
+ }
+
+ public void setTaskManagementConfig(TaskManagementConfig taskManagementConfig) {
+ this.taskManagementConfig = taskManagementConfig;
+ }
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/TaskManagementConfig.java b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/TaskManagementConfig.java
new file mode 100755
index 0000000000..2b3ae468ac
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/TaskManagementConfig.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.core.config;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Represents Task Mgt configuration.
+ */
+@XmlRootElement(name = "TaskMgtConfiguration")
+@SuppressWarnings("unused")
+public final class TaskManagementConfig {
+
+ private TaskManagementConfigRepository taskMgtConfigRepository;
+ private boolean isTaskWatcherEnabled;
+
+ @XmlElement(name = "ManagementRepository", required = true)
+ public TaskManagementConfigRepository getTaskMgtConfigRepository() {
+ return taskMgtConfigRepository;
+ }
+
+ public void setTaskMgtConfigRepository(TaskManagementConfigRepository taskMgtConfigRepository) {
+ this.taskMgtConfigRepository = taskMgtConfigRepository;
+ }
+
+ @XmlElement(name = "TaskWatcherEnable", required = true)
+ public boolean isTaskWatcherEnabled() {
+ return isTaskWatcherEnabled;
+ }
+
+ public void setTaskWatcherEnabled(boolean enabled) {
+ this.isTaskWatcherEnabled = enabled;
+ }
+}
+
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/TaskManagementConfigRepository.java b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/TaskManagementConfigRepository.java
new file mode 100755
index 0000000000..a81617f738
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/TaskManagementConfigRepository.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.core.config;
+
+import io.entgra.task.mgt.core.config.datasource.DataSourceConfig;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Class for holding management repository data.
+ */
+@XmlRootElement(name = "ManagementRepository")
+public class TaskManagementConfigRepository {
+
+ private DataSourceConfig dataSourceConfig;
+
+ @XmlElement(name = "DataSourceConfiguration", required = true)
+ public DataSourceConfig getDataSourceConfig() {
+ return dataSourceConfig;
+ }
+
+ public void setDataSourceConfig(DataSourceConfig dataSourceConfig) {
+ this.dataSourceConfig = dataSourceConfig;
+ }
+
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/datasource/DataSourceConfig.java b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/datasource/DataSourceConfig.java
new file mode 100755
index 0000000000..b4c4d9fc2d
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/datasource/DataSourceConfig.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.core.config.datasource;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Class for holding data source configuration in task-mgt-config.xml at parsing with JAXB.
+ */
+@XmlRootElement(name = "DataSourceConfiguration")
+public class DataSourceConfig {
+
+ private JNDILookupDefinition jndiLookupDefinition;
+
+ @XmlElement(name = "JndiLookupDefinition", required = true)
+ public JNDILookupDefinition getJndiLookupDefinition() {
+ return jndiLookupDefinition;
+ }
+
+ public void setJndiLookupDefinition(JNDILookupDefinition jndiLookupDefinition) {
+ this.jndiLookupDefinition = jndiLookupDefinition;
+ }
+
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/datasource/JNDILookupDefinition.java b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/datasource/JNDILookupDefinition.java
new file mode 100755
index 0000000000..5101af8d49
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/config/datasource/JNDILookupDefinition.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+
+package io.entgra.task.mgt.core.config.datasource;
+
+import javax.xml.bind.annotation.*;
+import java.util.List;
+
+/**
+ * Class for hold JndiLookupDefinition of task-mgt-config.xml at parsing with JAXB.
+ */
+@XmlRootElement(name = "JndiLookupDefinition")
+public class JNDILookupDefinition {
+
+ private String jndiName;
+ private List jndiProperties;
+
+ @XmlElement(name = "Name", required = false)
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+
+ @XmlElementWrapper(name = "Environment", required = false)
+ @XmlElement(name = "Property", nillable = false)
+ public List getJndiProperties() {
+ return jndiProperties;
+ }
+
+ public void setJndiProperties(List jndiProperties) {
+ this.jndiProperties = jndiProperties;
+ }
+
+ @XmlRootElement(name = "Property")
+ public static class JNDIProperty {
+
+ private String name;
+
+ private String value;
+
+ @XmlAttribute(name = "Name")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @XmlValue
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+ }
+
+}
+
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/dao/DynamicTaskDAO.java b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/dao/DynamicTaskDAO.java
new file mode 100755
index 0000000000..317870dba1
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/dao/DynamicTaskDAO.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.core.dao;
+
+import io.entgra.task.mgt.common.bean.DynamicTask;
+import io.entgra.task.mgt.common.exception.TaskManagementDAOException;
+
+import java.util.List;
+
+/**
+ * This class represents the key operations associated with dynamic tasks.
+ */
+public interface DynamicTaskDAO {
+
+ int addTask(DynamicTask dynamicTask) throws TaskManagementDAOException;
+
+ boolean updateDynamicTask(DynamicTask dynamicTask) throws TaskManagementDAOException;
+
+ void deleteDynamicTask(int dynamicTaskId) throws TaskManagementDAOException;
+
+ DynamicTask getDynamicTaskById(int dynamicTaskId) throws TaskManagementDAOException;
+
+ List getAllDynamicTasks() throws TaskManagementDAOException;
+
+ List getActiveDynamicTasks() throws TaskManagementDAOException;
+
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/dao/DynamicTaskPropDAO.java b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/dao/DynamicTaskPropDAO.java
new file mode 100755
index 0000000000..b458417298
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/dao/DynamicTaskPropDAO.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.core.dao;
+
+import io.entgra.task.mgt.common.exception.TaskManagementDAOException;
+
+import java.util.Map;
+
+/**
+ * This class represents the key operations associated with dynamic task properties.
+ */
+public interface DynamicTaskPropDAO {
+
+ void addTaskProperties(int dynamicTaskId, Map properties) throws TaskManagementDAOException;
+
+ Map getDynamicTaskProps(int dynamicTaskId) throws TaskManagementDAOException;
+
+ void updateDynamicTaskProps(int dynamicTaskId, Map properties)
+ throws TaskManagementDAOException;
+}
diff --git a/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/dao/common/TaskManagementDAOFactory.java b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/dao/common/TaskManagementDAOFactory.java
new file mode 100755
index 0000000000..c8f8623777
--- /dev/null
+++ b/components/task-mgt/task-manager/io.entgra.task.mgt.core/src/main/java/io/entgra/task/mgt/core/dao/common/TaskManagementDAOFactory.java
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Entgra Pvt Ltd. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.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.
+ */
+package io.entgra.task.mgt.core.dao.common;
+
+import io.entgra.task.mgt.common.constant.TaskMgtConstants;
+import io.entgra.task.mgt.common.exception.IllegalTransactionStateException;
+import io.entgra.task.mgt.common.exception.TransactionManagementException;
+import io.entgra.task.mgt.common.exception.UnsupportedDatabaseEngineException;
+import io.entgra.task.mgt.core.config.datasource.DataSourceConfig;
+import io.entgra.task.mgt.core.config.datasource.JNDILookupDefinition;
+import io.entgra.task.mgt.core.dao.DynamicTaskDAO;
+import io.entgra.task.mgt.core.dao.DynamicTaskPropDAO;
+import io.entgra.task.mgt.core.dao.impl.DynamicTaskDAOImpl;
+import io.entgra.task.mgt.core.dao.impl.DynamicTaskPropDAOImpl;
+import io.entgra.task.mgt.core.dao.util.TaskManagementDAOUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Hashtable;
+import java.util.List;
+
+public class TaskManagementDAOFactory {
+
+ private static DataSource dataSource;
+ private static String databaseEngine;
+ private static final Log log = LogFactory.getLog(TaskManagementDAOFactory.class);
+ private static ThreadLocal currentConnection = new ThreadLocal<>();
+
+
+ public static DynamicTaskDAO getDynamicTaskDAO() {
+ if (databaseEngine != null) {
+ switch (databaseEngine) {
+ case TaskMgtConstants.DataBaseTypes.DB_TYPE_H2:
+ case TaskMgtConstants.DataBaseTypes.DB_TYPE_MYSQL:
+ return new DynamicTaskDAOImpl();
+ default:
+ throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
+ }
+ }
+ throw new IllegalStateException("Database engine has not initialized properly.");
+ }
+
+ public static DynamicTaskPropDAO getDynamicTaskPropDAO() {
+ if (databaseEngine != null) {
+ switch (databaseEngine) {
+ case TaskMgtConstants.DataBaseTypes.DB_TYPE_H2:
+ case TaskMgtConstants.DataBaseTypes.DB_TYPE_MYSQL:
+ return new DynamicTaskPropDAOImpl();
+ default:
+ throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
+ }
+ }
+ throw new IllegalStateException("Database engine has not initialized properly.");
+ }
+
+ public static void init(DataSourceConfig config) {
+ dataSource = resolveDataSource(config);
+ try {
+ databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
+ } catch (SQLException e) {
+ log.error("Error occurred while retrieving config.datasource connection", e);
+ }
+ }
+
+ public static void init(DataSource dtSource) {
+ dataSource = dtSource;
+ try {
+ databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
+ } catch (SQLException e) {
+ log.error("Error occurred while retrieving config.datasource connection", e);
+ }
+ }
+
+ public static void beginTransaction() throws TransactionManagementException {
+ Connection conn = currentConnection.get();
+ if (conn != null) {
+ throw new IllegalTransactionStateException("A transaction is already active within the context of " +
+ "this particular thread. Therefore, calling 'beginTransaction/openConnection' while another " +
+ "transaction is already active is a sign of improper transaction handling");
+ }
+ try {
+ conn = dataSource.getConnection();
+ conn.setAutoCommit(false);
+ currentConnection.set(conn);
+ } catch (SQLException e) {
+ throw new TransactionManagementException("Error occurred while retrieving config.datasource connection", e);
+ }
+ }
+
+ public static void openConnection() throws SQLException {
+ Connection conn = currentConnection.get();
+ if (conn != null) {
+ throw new IllegalTransactionStateException("A transaction is already active within the context of " +
+ "this particular thread. Therefore, calling 'beginTransaction/openConnection' while another " +
+ "transaction is already active is a sign of improper transaction handling");
+ }
+ conn = dataSource.getConnection();
+ currentConnection.set(conn);
+ }
+
+ public static Connection getConnection() throws SQLException {
+ Connection conn = currentConnection.get();
+ if (conn == null) {
+ throw new IllegalTransactionStateException("No connection is associated with the current transaction. " +
+ "This might have ideally been caused by not properly initiating the transaction via " +
+ "'beginTransaction'/'openConnection' methods");
+ }
+ return conn;
+ }
+
+ public static void commitTransaction() {
+ Connection conn = currentConnection.get();
+ if (conn == null) {
+ throw new IllegalTransactionStateException("No connection is associated with the current transaction. " +
+ "This might have ideally been caused by not properly initiating the transaction via " +
+ "'beginTransaction'/'openConnection' methods");
+ }
+ try {
+ conn.commit();
+ } catch (SQLException e) {
+ log.error("Error occurred while committing the transaction", e);
+ }
+ }
+
+ public static void rollbackTransaction() {
+ Connection conn = currentConnection.get();
+ if (conn == null) {
+ throw new IllegalTransactionStateException("No connection is associated with the current transaction. " +
+ "This might have ideally been caused by not properly initiating the transaction via " +
+ "'beginTransaction'/'openConnection' methods");
+ }
+ try {
+ conn.rollback();
+ } catch (SQLException e) {
+ log.warn("Error occurred while roll-backing the transaction", e);
+ }
+ }
+
+ public static void closeConnection() {
+ Connection conn = currentConnection.get();
+ if (conn == null) {
+ throw new IllegalTransactionStateException("No connection is associated with the current transaction. " +
+ "This might have ideally been caused by not properly initiating the transaction via " +
+ "'beginTransaction'/'openConnection' methods");
+ }
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ log.warn("Error occurred while close the connection");
+ }
+ currentConnection.remove();
+ }
+
+
+ /**
+ * Resolve data source from the data source definition
+ *
+ * @param config data source configuration
+ * @return data source resolved from the data source definition
+ */
+ private static DataSource resolveDataSource(DataSourceConfig config) {
+ DataSource dataSource = null;
+ if (config == null) {
+ throw new RuntimeException(
+ "Device Management Repository data source configuration " + "is null and " +
+ "thus, is not initialized");
+ }
+ io.entgra.task.mgt.core.config.datasource.JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition();
+ if (jndiConfig != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Initializing Device Management Repository data source using the JNDI " +
+ "Lookup Definition");
+ }
+ List jndiPropertyList =
+ jndiConfig.getJndiProperties();
+ if (jndiPropertyList != null) {
+ Hashtable