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 46b7f07852..8d77d48888 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
@@ -80,6 +80,8 @@
org.wso2.carbon.identity.oauth.stub.dto,
org.wso2.carbon.ndatasource.core,
org.wso2.carbon.apimgt.impl,
+ org.wso2.carbon.ntask.core.*,
+ org.wso2.carbon.ntask.common,
org.wso2.carbon.ndatasource.core,
org.apache.axis2.transport.mail,
org.apache.catalina,
@@ -216,6 +218,18 @@
org.wso2.tomcat
tomcat-servlet-api
+
+
+
+ org.wso2.carbon.commons
+ org.wso2.carbon.ntask.core
+
+
+
+
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfigRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfigRepository.java
index d3bfb77b9a..6434a5d0e5 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfigRepository.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfigRepository.java
@@ -21,6 +21,7 @@ import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
import org.wso2.carbon.device.mgt.core.config.email.EmailConfigurations;
import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations;
import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration;
+import org.wso2.carbon.device.mgt.core.config.task.TaskConfiguration;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@@ -31,44 +32,54 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "ManagementRepository")
public class DeviceManagementConfigRepository {
- private DataSourceConfig dataSourceConfig;
- private EmailConfigurations emailConfigurations;
- private IdentityConfigurations identityConfigurations;
- private PolicyConfiguration policyConfiguration;
+ private DataSourceConfig dataSourceConfig;
+ private EmailConfigurations emailConfigurations;
+ private IdentityConfigurations identityConfigurations;
+ private PolicyConfiguration policyConfiguration;
+ private TaskConfiguration taskConfiguration;
- @XmlElement(name = "DataSourceConfiguration", required = true)
- public DataSourceConfig getDataSourceConfig() {
- return dataSourceConfig;
- }
+ @XmlElement(name = "DataSourceConfiguration", required = true)
+ public DataSourceConfig getDataSourceConfig() {
+ return dataSourceConfig;
+ }
- public void setDataSourceConfig(DataSourceConfig dataSourceConfig) {
- this.dataSourceConfig = dataSourceConfig;
- }
+ public void setDataSourceConfig(DataSourceConfig dataSourceConfig) {
+ this.dataSourceConfig = dataSourceConfig;
+ }
- @XmlElement(name = "EmailClientConfiguration", required = true)
- public EmailConfigurations getEmailConfigurations() {
- return emailConfigurations;
- }
+ @XmlElement(name = "EmailClientConfiguration", required = true)
+ public EmailConfigurations getEmailConfigurations() {
+ return emailConfigurations;
+ }
- public void setEmailConfigurations(EmailConfigurations emailConfigurations) {
- this.emailConfigurations = emailConfigurations;
- }
+ public void setEmailConfigurations(EmailConfigurations emailConfigurations) {
+ this.emailConfigurations = emailConfigurations;
+ }
- @XmlElement(name = "IdentityConfiguration", required = true)
- public IdentityConfigurations getIdentityConfigurations() {
- return identityConfigurations;
- }
+ @XmlElement(name = "IdentityConfiguration", required = true)
+ public IdentityConfigurations getIdentityConfigurations() {
+ return identityConfigurations;
+ }
- public void setIdentityConfigurations(IdentityConfigurations identityConfigurations) {
- this.identityConfigurations = identityConfigurations;
- }
+ public void setIdentityConfigurations(IdentityConfigurations identityConfigurations) {
+ this.identityConfigurations = identityConfigurations;
+ }
- @XmlElement(name = "PolicyConfiguration", required = true)
- public PolicyConfiguration getPolicyConfiguration() {
- return policyConfiguration;
- }
+ @XmlElement(name = "PolicyConfiguration", required = true)
+ public PolicyConfiguration getPolicyConfiguration() {
+ return policyConfiguration;
+ }
- public void setPolicyConfiguration(PolicyConfiguration policyConfiguration) {
- this.policyConfiguration = policyConfiguration;
- }
+ public void setPolicyConfiguration(PolicyConfiguration policyConfiguration) {
+ this.policyConfiguration = policyConfiguration;
+ }
+
+ @XmlElement(name = "TaskConfiguration", required = true)
+ public TaskConfiguration getTaskConfiguration() {
+ return taskConfiguration;
+ }
+
+ public void setTaskConfiguration(TaskConfiguration taskConfiguration) {
+ this.taskConfiguration = taskConfiguration;
+ }
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java
index 0921ef5081..d0e18f017f 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementDataHolder.java
@@ -25,6 +25,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig;
import org.wso2.carbon.device.mgt.core.config.license.LicenseConfig;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
+import org.wso2.carbon.ntask.core.service.TaskService;
import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.user.core.service.RealmService;
import org.wso2.carbon.user.core.tenant.TenantManager;
@@ -46,6 +47,7 @@ public class DeviceManagementDataHolder {
private ConfigurationContextService configurationContextService;
private HashMap requireDeviceAuthorization = new HashMap<>();
private DeviceAccessAuthorizationService deviceAccessAuthorizationService;
+ private TaskService taskService;
private static DeviceManagementDataHolder thisInstance = new DeviceManagementDataHolder();
@@ -164,4 +166,12 @@ public class DeviceManagementDataHolder {
DeviceAccessAuthorizationService deviceAccessAuthorizationService) {
this.deviceAccessAuthorizationService = deviceAccessAuthorizationService;
}
+
+ public TaskService getTaskService() {
+ return taskService;
+ }
+
+ public void setTaskService(TaskService taskService) {
+ this.taskService = taskService;
+ }
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java
index bf2ee59a39..b03e9d3350 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java
@@ -22,6 +22,7 @@ import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.Device;
+import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.TransactionManagementException;
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
@@ -37,10 +38,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
public final class DeviceManagerUtil {
@@ -167,4 +165,17 @@ public final class DeviceManagerUtil {
return ctx.getTenantId();
}
+
+ public static List convertDevices(List devices) {
+
+ List deviceIdentifiers = new ArrayList<>();
+ for (Device device : devices) {
+ DeviceIdentifier identifier = new DeviceIdentifier();
+ identifier.setId(device.getDeviceIdentifier());
+ identifier.setType(device.getType());
+ deviceIdentifiers.add(identifier);
+ }
+ return deviceIdentifiers;
+ }
+
}
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml
index 78c5aef868..a05f7c09cd 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml
@@ -45,6 +45,25 @@
8
20
+
+ true
+ 600000
+ org.wso2.carbon.device.mgt.core.task.impl.DeviceDetailsRetrieverTask
+
+
+ DEVICE_INFO
+ 1
+
+
+ APPLICATION_LIST
+ 5
+
+
+ LOCATION
+ 1
+
+
+