|
|
@ -22,6 +22,8 @@ import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.wso2.carbon.context.CarbonContext;
|
|
|
|
import org.wso2.carbon.context.CarbonContext;
|
|
|
|
import org.wso2.carbon.device.mgt.common.*;
|
|
|
|
import org.wso2.carbon.device.mgt.common.*;
|
|
|
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
|
|
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation;
|
|
|
|
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
|
|
|
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
|
|
|
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
|
|
|
|
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
|
|
@ -32,6 +34,8 @@ import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfi
|
|
|
|
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
|
|
|
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
|
|
|
import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository;
|
|
|
|
import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dao.*;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dao.*;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.device.details.mgt.dao.DeviceDetailsDAO;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.device.details.mgt.dao.DeviceDetailsMgtDAOException;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent;
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent;
|
|
|
@ -53,6 +57,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
|
|
|
|
|
|
|
|
private static Log log = LogFactory.getLog(DeviceManagementProviderServiceImpl.class);
|
|
|
|
private static Log log = LogFactory.getLog(DeviceManagementProviderServiceImpl.class);
|
|
|
|
private DeviceDAO deviceDAO;
|
|
|
|
private DeviceDAO deviceDAO;
|
|
|
|
|
|
|
|
private DeviceDetailsDAO deviceInfoDAO;
|
|
|
|
private DeviceTypeDAO deviceTypeDAO;
|
|
|
|
private DeviceTypeDAO deviceTypeDAO;
|
|
|
|
private EnrollmentDAO enrollmentDAO;
|
|
|
|
private EnrollmentDAO enrollmentDAO;
|
|
|
|
private DeviceManagementPluginRepository pluginRepository;
|
|
|
|
private DeviceManagementPluginRepository pluginRepository;
|
|
|
@ -69,6 +74,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
|
|
|
|
|
|
|
|
private void initDataAccessObjects() {
|
|
|
|
private void initDataAccessObjects() {
|
|
|
|
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
|
|
|
|
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
|
|
|
|
|
|
|
|
this.deviceInfoDAO = DeviceManagementDAOFactory.getDeviceDetailsDAO();
|
|
|
|
this.deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO();
|
|
|
|
this.deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO();
|
|
|
|
this.enrollmentDAO = DeviceManagementDAOFactory.getEnrollmentDAO();
|
|
|
|
this.enrollmentDAO = DeviceManagementDAOFactory.getEnrollmentDAO();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -379,6 +385,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(device.getType());
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(device.getType());
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
@ -420,6 +444,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(device.getType());
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(device.getType());
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
@ -463,6 +505,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(device.getType());
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(device.getType());
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
@ -493,6 +553,12 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
allDevices = deviceDAO.getDevices(deviceType, this.getTenantId());
|
|
|
|
allDevices = deviceDAO.getDevices(deviceType, this.getTenantId());
|
|
|
|
|
|
|
|
if (allDevices == null) {
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("No device is found upon the type '" + deviceType + "'");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
throw new DeviceManagementException("Error occurred while retrieving all devices of type '" +
|
|
|
|
throw new DeviceManagementException("Error occurred while retrieving all devices of type '" +
|
|
|
|
deviceType + "' that are being managed within the scope of current tenant", e);
|
|
|
|
deviceType + "' that are being managed within the scope of current tenant", e);
|
|
|
@ -503,6 +569,25 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(deviceType);
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(deviceType);
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
@ -573,15 +658,29 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
device = deviceDAO.getDevice(deviceId, this.getTenantId());
|
|
|
|
device = deviceDAO.getDevice(deviceId, this.getTenantId());
|
|
|
|
|
|
|
|
if (device == null) {
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("No device is found upon the type '" + deviceId.getType() + "' and id '" +
|
|
|
|
|
|
|
|
deviceId.getId() + "'");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DeviceInfo info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
throw new DeviceManagementException("Error occurred while obtaining the device for id " +
|
|
|
|
throw new DeviceManagementException("Error occurred while obtaining the device for id " +
|
|
|
|
"'" + deviceId.getId() + "'", e);
|
|
|
|
"'" + deviceId.getId() + "'", e);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
|
|
|
|
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
throw new DeviceManagementException("Error occurred while fetching advanced device information", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (device != null) {
|
|
|
|
|
|
|
|
// The changes made here to prevent unit tests getting failed. They failed because when running the unit
|
|
|
|
// The changes made here to prevent unit tests getting failed. They failed because when running the unit
|
|
|
|
// tests there is no osgi services. So getDeviceManager() returns a null.
|
|
|
|
// tests there is no osgi services. So getDeviceManager() returns a null.
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(deviceId.getType());
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(deviceId.getType());
|
|
|
@ -597,7 +696,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
device.setFeatures(pluginSpecificInfo.getFeatures());
|
|
|
|
device.setFeatures(pluginSpecificInfo.getFeatures());
|
|
|
|
device.setProperties(pluginSpecificInfo.getProperties());
|
|
|
|
device.setProperties(pluginSpecificInfo.getProperties());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return device;
|
|
|
|
return device;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -607,15 +705,30 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
device = deviceDAO.getDevice(deviceId, status, this.getTenantId());
|
|
|
|
device = deviceDAO.getDevice(deviceId, status, this.getTenantId());
|
|
|
|
|
|
|
|
if (device == null) {
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("No device is found upon the type '" + deviceId.getType() + "' and id '" +
|
|
|
|
|
|
|
|
deviceId.getId() + "'");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DeviceInfo info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
throw new DeviceManagementException("Error occurred while obtaining the device for id " +
|
|
|
|
throw new DeviceManagementException("Error occurred while obtaining the device for id " +
|
|
|
|
"'" + deviceId.getId() + "'", e);
|
|
|
|
"'" + deviceId.getId() + "'", e);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
|
|
|
|
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
throw new DeviceManagementException("Error occurred while obtaining information of the device with id " +
|
|
|
|
|
|
|
|
"'" + deviceId.getId() + "'", e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (device != null) {
|
|
|
|
|
|
|
|
// The changes made here to prevent unit tests getting failed. They failed because when running the unit
|
|
|
|
// The changes made here to prevent unit tests getting failed. They failed because when running the unit
|
|
|
|
// tests there is no osgi services. So getDeviceManager() returns a null.
|
|
|
|
// tests there is no osgi services. So getDeviceManager() returns a null.
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(deviceId.getType());
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(deviceId.getType());
|
|
|
@ -631,7 +744,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
device.setFeatures(pluginSpecificInfo.getFeatures());
|
|
|
|
device.setFeatures(pluginSpecificInfo.getFeatures());
|
|
|
|
device.setProperties(pluginSpecificInfo.getProperties());
|
|
|
|
device.setProperties(pluginSpecificInfo.getProperties());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return device;
|
|
|
|
return device;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -883,6 +995,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (Device device : userDevices) {
|
|
|
|
for (Device device : userDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(device.getType());
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(device.getType());
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
@ -926,6 +1056,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (Device device : userDevices) {
|
|
|
|
for (Device device : userDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(device.getType());
|
|
|
|
DeviceManager deviceManager = this.getDeviceManager(device.getType());
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (deviceManager == null) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
@ -971,6 +1119,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
if (dmsDevice != null) {
|
|
|
|
if (dmsDevice != null) {
|
|
|
@ -1010,6 +1176,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Device device : userDevices) {
|
|
|
|
for (Device device : userDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
if (dmsDevice != null) {
|
|
|
|
if (dmsDevice != null) {
|
|
|
@ -1067,6 +1251,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
if (dmsDevice != null) {
|
|
|
|
if (dmsDevice != null) {
|
|
|
@ -1101,6 +1303,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
if (dmsDevice != null) {
|
|
|
|
if (dmsDevice != null) {
|
|
|
@ -1180,6 +1400,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
if (dmsDevice != null) {
|
|
|
|
if (dmsDevice != null) {
|
|
|
@ -1214,6 +1452,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
for (Device device : allDevices) {
|
|
|
|
|
|
|
|
DeviceInfo info = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
info = deviceInfoDAO.getDeviceInformation(device.getId());
|
|
|
|
|
|
|
|
DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId());
|
|
|
|
|
|
|
|
if (info != null) {
|
|
|
|
|
|
|
|
info.setLocation(location);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
|
|
|
|
} catch (DeviceDetailsMgtDAOException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while retrieving advance info of '" + device.getType() +
|
|
|
|
|
|
|
|
"' that carries the id '" + device.getDeviceIdentifier() + "'");
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
log.error("Error occurred while opening a connection to the data source", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
device.setDeviceInfo(info);
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
Device dmsDevice = this.getDeviceManager(device.getType()).
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
if (dmsDevice != null) {
|
|
|
|
if (dmsDevice != null) {
|
|
|
|