|
|
|
@ -23,7 +23,6 @@ import com.google.gson.Gson;
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.task.DeviceMgtTaskException;
|
|
|
|
@ -34,7 +33,6 @@ import org.wso2.carbon.user.api.UserStoreException;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
public class DeviceDetailsRetrieverTask implements Task {
|
|
|
|
@ -66,18 +64,15 @@ public class DeviceDetailsRetrieverTask implements Task {
|
|
|
|
|
log.debug("Device details retrieving task started to run.");
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
// Tenant tenants[] = DeviceManagementDataHolder.getInstance().
|
|
|
|
|
// getRealmService().getTenantManager().getAllTenants();
|
|
|
|
|
|
|
|
|
|
List<Integer> tenants = DeviceManagementDataHolder.getInstance().
|
|
|
|
|
getDeviceManagementProvider().getDeviceEnrolledTenants();
|
|
|
|
|
for (Integer tenant : tenants) {
|
|
|
|
|
String tenantDomain = DeviceManagementDataHolder.getInstance().
|
|
|
|
|
getRealmService().getTenantManager().getDomain(tenant);
|
|
|
|
|
Tenant tenants[] = DeviceManagementDataHolder.getInstance().
|
|
|
|
|
getRealmService().getTenantManager().getAllTenants();
|
|
|
|
|
|
|
|
|
|
for (Tenant tenant : tenants) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
PrivilegedCarbonContext.startTenantFlow();
|
|
|
|
|
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain);
|
|
|
|
|
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenant);
|
|
|
|
|
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenant.getDomain());
|
|
|
|
|
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenant.getId());
|
|
|
|
|
DeviceTaskManager deviceTaskManager = new DeviceTaskManagerImpl(deviceType,
|
|
|
|
|
operationMonitoringTaskConfig);
|
|
|
|
|
//pass the configurations also from here, monitoring tasks
|
|
|
|
@ -93,9 +88,6 @@ public class DeviceDetailsRetrieverTask implements Task {
|
|
|
|
|
}
|
|
|
|
|
} catch (UserStoreException e) {
|
|
|
|
|
log.error("Error occurred while trying to get the available tenants", e);
|
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
|
log.error("Error occurred while trying to get the available tenants " +
|
|
|
|
|
"from device manager provider service.", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|