diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidFeatureManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidFeatureManager.java index 0dcf3c049..cb7373279 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidFeatureManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidFeatureManager.java @@ -95,8 +95,8 @@ public class AndroidFeatureManager implements FeatureManager { } catch (MobileDeviceManagementDAOException e1) { log.warn("Error occurred while roll-backing the transaction", e); } - throw new DeviceManagementException("Error occurred while retrieving the list of features registered " + - "for Android platform", e); + throw new DeviceManagementException("Error occurred while retrieving the list of " + + "features registered for Android platform", e); } } @@ -119,4 +119,4 @@ public class AndroidFeatureManager implements FeatureManager { return status; } -} +} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidDeviceDAOImpl.java index 089719f71..2927e523f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidDeviceDAOImpl.java @@ -58,16 +58,17 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{ try { conn = this.getConnection(); String selectDBQuery = - "SELECT ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, VENDOR, MAC_ADDRESS, " + - "DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION FROM AD_DEVICE WHERE" + - " ANDROID_DEVICE_ID = ?"; + "SELECT ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, " + + "VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION" + + " FROM AD_DEVICE WHERE ANDROID_DEVICE_ID = ?"; stmt = conn.prepareStatement(selectDBQuery); stmt.setString(1, mblDeviceId); ResultSet resultSet = stmt.executeQuery(); if (resultSet.next()) { mobileDevice = new MobileDevice(); - mobileDevice.setMobileDeviceId(resultSet.getString(AndroidPluginConstants.ANDROID_DEVICE_ID)); + mobileDevice.setMobileDeviceId(resultSet.getString(AndroidPluginConstants. + ANDROID_DEVICE_ID)); mobileDevice.setModel(resultSet.getString(AndroidPluginConstants.DEVICE_MODEL)); mobileDevice.setSerial(resultSet.getString(AndroidPluginConstants.SERIAL)); mobileDevice.setVendor(resultSet.getString(AndroidPluginConstants.VENDOR)); @@ -88,7 +89,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{ mobileDevice.setDeviceProperties(propertyMap); if (log.isDebugEnabled()) { - log.debug("Android device " + mblDeviceId + " data has been fetched from Android database."); + log.debug("Android device " + mblDeviceId + " data has been fetched from " + + "Android database."); } } } catch (SQLException e) { @@ -112,8 +114,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{ conn = this.getConnection(); String createDBQuery = "INSERT INTO AD_DEVICE(ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, SERIAL, " + - "VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION, DEVICE_MODEL)" + - " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + "VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, " + + "OS_VERSION, DEVICE_MODEL) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; stmt = conn.prepareStatement(createDBQuery); stmt.setString(1, mobileDevice.getMobileDeviceId()); @@ -142,8 +144,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{ if (rows > 0) { status = true; if (log.isDebugEnabled()) { - log.debug("Android device " + mobileDevice.getMobileDeviceId() + " data has been added" + - " to the Android database."); + log.debug("Android device " + mobileDevice.getMobileDeviceId() + " data has been" + + " added to the Android database."); } } } catch (SQLException e) { @@ -166,9 +168,9 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{ try { conn = this.getConnection(); String updateDBQuery = - "UPDATE AD_DEVICE SET GCM_TOKEN = ?, DEVICE_INFO = ?, SERIAL = ?, VENDOR = ?, MAC_ADDRESS = ?, " + - "DEVICE_NAME = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, IMSI = ?, OS_VERSION = ?, DEVICE_MODEL = ? " + - "WHERE ANDROID_DEVICE_ID = ?"; + "UPDATE AD_DEVICE SET GCM_TOKEN = ?, DEVICE_INFO = ?, SERIAL = ?, VENDOR = ?, " + + "MAC_ADDRESS = ?, DEVICE_NAME = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, " + + "IMSI = ?, OS_VERSION = ?, DEVICE_MODEL = ? WHERE ANDROID_DEVICE_ID = ?"; stmt = conn.prepareStatement(updateDBQuery); @@ -252,13 +254,15 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{ try { conn = this.getConnection(); String selectDBQuery = - "SELECT ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, VENDOR, " + - "MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, 0S_VERSION FROM AD_DEVICE"; + "SELECT ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, " + + "VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION " + + "FROM AD_DEVICE"; stmt = conn.prepareStatement(selectDBQuery); ResultSet resultSet = stmt.executeQuery(); while (resultSet.next()) { mobileDevice = new MobileDevice(); - mobileDevice.setMobileDeviceId(resultSet.getString(AndroidPluginConstants.ANDROID_DEVICE_ID)); + mobileDevice.setMobileDeviceId(resultSet.getString(AndroidPluginConstants. + ANDROID_DEVICE_ID)); mobileDevice.setModel(resultSet.getString(AndroidPluginConstants.DEVICE_MODEL)); mobileDevice.setSerial(resultSet.getString(AndroidPluginConstants.SERIAL)); mobileDevice.setVendor(resultSet.getString(AndroidPluginConstants.VENDOR)); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java index 43e56ef9f..b214fff9c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java @@ -46,7 +46,8 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { } @Override - public boolean addFeature(MobileFeature mobileFeature) throws MobileDeviceManagementDAOException { + public boolean addFeature(MobileFeature mobileFeature) throws + MobileDeviceManagementDAOException { PreparedStatement stmt = null; boolean status = false; try { @@ -70,7 +71,8 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { } @Override - public boolean updateFeature(MobileFeature mobileFeature) throws MobileDeviceManagementDAOException { + public boolean updateFeature(MobileFeature mobileFeature) throws + MobileDeviceManagementDAOException { boolean status = false; Connection conn = null; PreparedStatement stmt = null; @@ -89,7 +91,8 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { if (rows > 0) { status = true; if (log.isDebugEnabled()) { - log.debug("Android Feature " + mobileFeature.getCode() + " data has been modified."); + log.debug("Android Feature " + mobileFeature.getCode() + " data has been " + + "modified."); } } } catch (SQLException e) { @@ -125,7 +128,8 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { } @Override - public boolean deleteFeatureByCode(String mblFeatureCode) throws MobileDeviceManagementDAOException { + public boolean deleteFeatureByCode(String mblFeatureCode) throws + MobileDeviceManagementDAOException { PreparedStatement stmt = null; boolean status = false; try { @@ -146,7 +150,8 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { } @Override - public MobileFeature getFeatureById(int mblFeatureId) throws MobileDeviceManagementDAOException { + public MobileFeature getFeatureById(int mblFeatureId) throws + MobileDeviceManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; try { @@ -162,7 +167,8 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { mobileFeature.setId(rs.getInt(AndroidPluginConstants.ANDROID_FEATURE_ID)); mobileFeature.setCode(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_CODE)); mobileFeature.setName(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_NAME)); - mobileFeature.setDescription(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_DESCRIPTION)); + mobileFeature.setDescription(rs.getString(AndroidPluginConstants. + ANDROID_FEATURE_DESCRIPTION)); mobileFeature.setDeviceType( DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); } @@ -177,7 +183,8 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { } @Override - public MobileFeature getFeatureByCode(String mblFeatureCode) throws MobileDeviceManagementDAOException { + public MobileFeature getFeatureByCode(String mblFeatureCode) throws + MobileDeviceManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; try { @@ -193,7 +200,8 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { mobileFeature.setId(rs.getInt(AndroidPluginConstants.ANDROID_FEATURE_ID)); mobileFeature.setCode(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_CODE)); mobileFeature.setName(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_NAME)); - mobileFeature.setDescription(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_DESCRIPTION)); + mobileFeature.setDescription(rs.getString(AndroidPluginConstants. + ANDROID_FEATURE_DESCRIPTION)); mobileFeature.setDeviceType( DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); } @@ -231,15 +239,16 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { mobileFeature.setId(rs.getInt(AndroidPluginConstants.ANDROID_FEATURE_ID)); mobileFeature.setCode(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_CODE)); mobileFeature.setName(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_NAME)); - mobileFeature.setDescription(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_DESCRIPTION)); + mobileFeature.setDescription(rs.getString(AndroidPluginConstants. + ANDROID_FEATURE_DESCRIPTION)); mobileFeature.setDeviceType( DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); features.add(mobileFeature); } return features; } catch (SQLException e) { - throw new AndroidFeatureManagementDAOException("Error occurred while retrieving all android " + - "features from the android database.", e); + throw new AndroidFeatureManagementDAOException("Error occurred while retrieving all " + + "android features from the android database.", e); } finally { MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java index c48e5d1a7..2c47e5bff 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java @@ -78,9 +78,11 @@ public class MobileDeviceManagementServiceComponent { Map dsConfigMap = config.getMobileDeviceMgtRepository().getMobileDataSourceConfigMap(); MobileDeviceManagementDAOFactory.setMobileDataSourceConfigMap(dsConfigMap); - IOSDAOFactory.init(dsConfigMap.get(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS)); + IOSDAOFactory.init(dsConfigMap.get(DeviceManagementConstants.MobileDeviceTypes. + MOBILE_DEVICE_TYPE_IOS)); AndroidDAOFactory - .init(dsConfigMap.get(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID)); + .init(dsConfigMap.get(DeviceManagementConstants.MobileDeviceTypes. + MOBILE_DEVICE_TYPE_ANDROID)); String setupOption = System.getProperty("setup"); if (setupOption != null) { @@ -90,7 +92,8 @@ public class MobileDeviceManagementServiceComponent { "to begin"); } try { - Map dataSourceMap = MobileDeviceManagementDAOFactory.getDataSourceMap(); + Map dataSourceMap = MobileDeviceManagementDAOFactory. + getDataSourceMap(); for (DataSource dataSource : dataSourceMap.values()) { MobileDeviceManagementDAOUtil .setupMobileDeviceManagementSchema(dataSource);