diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java index c9a501714..0417af08e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java @@ -21,8 +21,6 @@ package org.wso2.carbon.device.mgt.mobile.impl.android; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.*; - -import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; @@ -33,318 +31,331 @@ import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice; import org.wso2.carbon.device.mgt.mobile.impl.android.dao.AndroidDAOFactory; +import org.wso2.carbon.device.mgt.mobile.impl.android.util.AndroidPluginConstants; import org.wso2.carbon.device.mgt.mobile.impl.android.util.AndroidPluginUtils; import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil; -import org.wso2.carbon.registry.api.Collection; import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import java.io.StringReader; +import java.io.StringWriter; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; public class AndroidDeviceManager implements DeviceManager { - private MobileDeviceManagementDAOFactory daoFactory; - private static final Log log = LogFactory.getLog(AndroidDeviceManagementService.class); - private FeatureManager featureManager = new AndroidFeatureManager(); - private LicenseManager licenseManager; + private MobileDeviceManagementDAOFactory daoFactory; + private static final Log log = LogFactory.getLog(AndroidDeviceManagementService.class); + private FeatureManager featureManager = new AndroidFeatureManager(); + private LicenseManager licenseManager; + + public AndroidDeviceManager() { + this.daoFactory = new AndroidDAOFactory(); + this.licenseManager = new RegistryBasedLicenseManager(); - public AndroidDeviceManager() { - this.daoFactory = new AndroidDAOFactory(); - this.licenseManager = new RegistryBasedLicenseManager(); + License defaultLicense = AndroidPluginUtils.getDefaultLicense(); + try { + licenseManager + .addLicense(AndroidDeviceManagementService.DEVICE_TYPE_ANDROID, defaultLicense); + } catch (LicenseManagementException e) { + log.error("Error occurred while adding default license for Android devices", e); + } + } - License defaultLicense = AndroidPluginUtils.getDefaultLicense(); - try { - licenseManager.addLicense(AndroidDeviceManagementService.DEVICE_TYPE_ANDROID, defaultLicense); - } catch (LicenseManagementException e) { - log.error("Error occurred while adding default license for Android devices", e); - } - } + @Override + public FeatureManager getFeatureManager() { + return featureManager; + } - @Override - public FeatureManager getFeatureManager() { - return featureManager; - } + @Override + public boolean saveConfiguration(TenantConfiguration tenantConfiguration) + throws DeviceManagementException { + boolean status = false; + Resource resource; + try { + if (log.isDebugEnabled()) { + log.debug("Persisting android configurations in Registry"); + } + String resourcePath = MobileDeviceManagementUtil.getPlatformConfigPath( + DeviceManagementConstants. + MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); + StringWriter writer = new StringWriter(); + JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); + Marshaller marshaller = context.createMarshaller(); + marshaller.marshal(tenantConfiguration, writer); - @Override - public boolean saveConfiguration(TenantConfiguration tenantConfiguration) - throws DeviceManagementException { - boolean status; - Resource resource; - try { - if (log.isDebugEnabled()) { - log.debug("Persisting android configurations in Registry"); - } - String resourcePath = MobileDeviceManagementUtil.getPlatformConfigPath( - DeviceManagementConstants. - MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - MobileDeviceManagementUtil.createRegistryCollection(resourcePath); - for (ConfigurationEntry configEntry : tenantConfiguration.getConfiguration()) { - resource = MobileDeviceManagementUtil.getRegistry().newResource(); - resource.setContent(configEntry.getValue()); - MobileDeviceManagementUtil.putRegistryResource(resourcePath + "/" + configEntry.getName(), resource); - } - status = true; - } catch (MobileDeviceMgtPluginException e) { - throw new DeviceManagementException( - "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); - } catch (RegistryException e) { - throw new DeviceManagementException( - "Error occurred while persisting the Registry resource : " + e.getMessage(), e); - } - return status; - } + resource = MobileDeviceManagementUtil.getRegistry().newResource(); + resource.setContent(writer.toString()); + resource.setMediaType(AndroidPluginConstants.MEDIA_TYPE_XML); + MobileDeviceManagementUtil.putRegistryResource(resourcePath, resource); + status = true; + } catch (MobileDeviceMgtPluginException e) { + throw new DeviceManagementException( + "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); + } catch (RegistryException e) { + throw new DeviceManagementException( + "Error occurred while persisting the Registry resource : " + e.getMessage(), e); + } catch (JAXBException e) { + throw new DeviceManagementException( + "Error occurred while parsing the configuration : " + e.getMessage(), e); + } + return status; + } - @Override - public TenantConfiguration getConfiguration() throws DeviceManagementException { - Collection dsCollection; - TenantConfiguration tenantConfiguration; - List configs = new ArrayList<>(); - ConfigurationEntry entry; - Resource resource; - try { - String androidRegPath = - MobileDeviceManagementUtil.getPlatformConfigPath(DeviceManagementConstants. - MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - dsCollection = - (Collection) MobileDeviceManagementUtil.getRegistryResource(androidRegPath); - String[] dsmPaths = dsCollection.getChildren(); - for (String dsmPath : dsmPaths) { - entry = new ConfigurationEntry(); - resource = MobileDeviceManagementUtil.getRegistryResource(dsmPath); - entry.setValue(resource.getContent()); - entry.setName(resource.getId()); - configs.add(entry); - } - tenantConfiguration = new TenantConfiguration(); - tenantConfiguration.setConfiguration(configs); - tenantConfiguration.setType(DeviceManagementConstants. - MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - } catch (MobileDeviceMgtPluginException e) { - throw new DeviceManagementException( - "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); - } catch (RegistryException e) { - throw new DeviceManagementException( - "Error occurred while retrieving the Registry data : " + e.getMessage(), e); - } - return tenantConfiguration; - } + @Override + public TenantConfiguration getConfiguration() throws DeviceManagementException { + Resource resource; + try { + String androidRegPath = + MobileDeviceManagementUtil.getPlatformConfigPath(DeviceManagementConstants. + MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); + resource = MobileDeviceManagementUtil.getRegistryResource(androidRegPath); + JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); + Unmarshaller unmarshaller = context.createUnmarshaller(); + return (TenantConfiguration) unmarshaller.unmarshal( + new StringReader(new String((byte[]) resource.getContent(), Charset + .forName("UTF8")))); - @Override - public boolean enrollDevice(Device device) throws DeviceManagementException { - boolean status = false; - MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); - try { - if (log.isDebugEnabled()) { - log.debug("Enrolling a new Android device : " + device.getDeviceIdentifier()); - } - boolean isEnrolled = this.isEnrolled(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (isEnrolled) { - this.modifyEnrollment(device); - } else { - AndroidDAOFactory.beginTransaction(); - status = daoFactory.getMobileDeviceDAO().addMobileDevice(mobileDevice); - AndroidDAOFactory.commitTransaction(); - } - } catch (MobileDeviceManagementDAOException e) { - try { - AndroidDAOFactory.rollbackTransaction(); - } catch (MobileDeviceManagementDAOException mobileDAOEx) { - String msg = "Error occurred while roll back the device enrol transaction :" + device.toString(); - log.warn(msg, mobileDAOEx); - } - String msg = "Error while enrolling the Android device : " + device.getDeviceIdentifier(); - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } - return status; - } + } catch (MobileDeviceMgtPluginException e) { + throw new DeviceManagementException( + "Error occurred while retrieving the Registry instance : " + e.getMessage(), e); + } catch (JAXBException e) { + throw new DeviceManagementException( + "Error occurred while parsing the configuration : " + e.getMessage(), e); + } catch (RegistryException e) { + throw new DeviceManagementException( + "Error occurred while retrieving the Registry resource : " + e.getMessage(), e); + } + } - @Override - public boolean modifyEnrollment(Device device) throws DeviceManagementException { - boolean status; - MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); - try { - if (log.isDebugEnabled()) { - log.debug("Modifying the Android device enrollment data"); - } - AndroidDAOFactory.beginTransaction(); - status = daoFactory.getMobileDeviceDAO().updateMobileDevice(mobileDevice); - AndroidDAOFactory.commitTransaction(); - } catch (MobileDeviceManagementDAOException e) { - try { - AndroidDAOFactory.rollbackTransaction(); - } catch (MobileDeviceManagementDAOException mobileDAOEx) { - String msg = "Error occurred while roll back the update device transaction :" + - device.toString(); - log.warn(msg, mobileDAOEx); - } - String msg = "Error while updating the enrollment of the Android device : " + - device.getDeviceIdentifier(); - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } - return status; - } + @Override + public boolean enrollDevice(Device device) throws DeviceManagementException { + boolean status = false; + MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); + try { + if (log.isDebugEnabled()) { + log.debug("Enrolling a new Android device : " + device.getDeviceIdentifier()); + } + boolean isEnrolled = this.isEnrolled( + new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); + if (isEnrolled) { + this.modifyEnrollment(device); + } else { + AndroidDAOFactory.beginTransaction(); + status = daoFactory.getMobileDeviceDAO().addMobileDevice(mobileDevice); + AndroidDAOFactory.commitTransaction(); + } + } catch (MobileDeviceManagementDAOException e) { + try { + AndroidDAOFactory.rollbackTransaction(); + } catch (MobileDeviceManagementDAOException mobileDAOEx) { + String msg = "Error occurred while roll back the device enrol transaction :" + + device.toString(); + log.warn(msg, mobileDAOEx); + } + String msg = + "Error while enrolling the Android device : " + device.getDeviceIdentifier(); + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } + return status; + } - @Override - public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { - boolean status; - try { - if (log.isDebugEnabled()) { - log.debug("Dis-enrolling Android device : " + deviceId); - } - AndroidDAOFactory.beginTransaction(); - status = daoFactory.getMobileDeviceDAO().deleteMobileDevice(deviceId.getId()); - AndroidDAOFactory.commitTransaction(); - } catch (MobileDeviceManagementDAOException e) { - try { - AndroidDAOFactory.rollbackTransaction(); - } catch (MobileDeviceManagementDAOException mobileDAOEx) { - String msg = "Error occurred while roll back the device dis enrol transaction :" + - deviceId.toString(); - log.warn(msg, mobileDAOEx); - } - String msg = "Error while removing the Android device : " + deviceId.getId(); - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } - return status; - } + @Override + public boolean modifyEnrollment(Device device) throws DeviceManagementException { + boolean status; + MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); + try { + if (log.isDebugEnabled()) { + log.debug("Modifying the Android device enrollment data"); + } + AndroidDAOFactory.beginTransaction(); + status = daoFactory.getMobileDeviceDAO().updateMobileDevice(mobileDevice); + AndroidDAOFactory.commitTransaction(); + } catch (MobileDeviceManagementDAOException e) { + try { + AndroidDAOFactory.rollbackTransaction(); + } catch (MobileDeviceManagementDAOException mobileDAOEx) { + String msg = "Error occurred while roll back the update device transaction :" + + device.toString(); + log.warn(msg, mobileDAOEx); + } + String msg = "Error while updating the enrollment of the Android device : " + + device.getDeviceIdentifier(); + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } + return status; + } - @Override - public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException { - boolean isEnrolled = false; - try { - if (log.isDebugEnabled()) { - log.debug("Checking the enrollment of Android device : " + deviceId.getId()); - } - MobileDevice mobileDevice = - daoFactory.getMobileDeviceDAO().getMobileDevice(deviceId.getId()); - if (mobileDevice != null) { - isEnrolled = true; - } - } catch (MobileDeviceManagementDAOException e) { - String msg = "Error while checking the enrollment status of Android device : " + - deviceId.getId(); - log.error(msg, e); - throw new DeviceManagementException(msg, e); - } - return isEnrolled; - } + @Override + public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { + boolean status; + try { + if (log.isDebugEnabled()) { + log.debug("Dis-enrolling Android device : " + deviceId); + } + AndroidDAOFactory.beginTransaction(); + status = daoFactory.getMobileDeviceDAO().deleteMobileDevice(deviceId.getId()); + AndroidDAOFactory.commitTransaction(); + } catch (MobileDeviceManagementDAOException e) { + try { + AndroidDAOFactory.rollbackTransaction(); + } catch (MobileDeviceManagementDAOException mobileDAOEx) { + String msg = "Error occurred while roll back the device dis enrol transaction :" + + deviceId.toString(); + log.warn(msg, mobileDAOEx); + } + String msg = "Error while removing the Android device : " + deviceId.getId(); + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } + return status; + } - @Override - public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException { - return true; - } + @Override + public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException { + boolean isEnrolled = false; + try { + if (log.isDebugEnabled()) { + log.debug("Checking the enrollment of Android device : " + deviceId.getId()); + } + MobileDevice mobileDevice = + daoFactory.getMobileDeviceDAO().getMobileDevice(deviceId.getId()); + if (mobileDevice != null) { + isEnrolled = true; + } + } catch (MobileDeviceManagementDAOException e) { + String msg = "Error while checking the enrollment status of Android device : " + + deviceId.getId(); + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } + return isEnrolled; + } - @Override - public boolean setActive(DeviceIdentifier deviceId, boolean status) - throws DeviceManagementException { - return true; - } + @Override + public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException { + return true; + } - @Override - public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException { - Device device; - try { - if (log.isDebugEnabled()) { - log.debug("Getting the details of Android device : '" + deviceId.getId() + "'"); - } - MobileDevice mobileDevice = daoFactory.getMobileDeviceDAO(). - getMobileDevice(deviceId.getId()); - device = MobileDeviceManagementUtil.convertToDevice(mobileDevice); - } catch (MobileDeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while fetching the Android device: '" + - deviceId.getId() + "'", e); - } - return device; - } + @Override + public boolean setActive(DeviceIdentifier deviceId, boolean status) + throws DeviceManagementException { + return true; + } - @Override - public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) - throws DeviceManagementException { - return true; - } + @Override + public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException { + Device device; + try { + if (log.isDebugEnabled()) { + log.debug("Getting the details of Android device : '" + deviceId.getId() + "'"); + } + MobileDevice mobileDevice = daoFactory.getMobileDeviceDAO(). + getMobileDevice(deviceId.getId()); + device = MobileDeviceManagementUtil.convertToDevice(mobileDevice); + } catch (MobileDeviceManagementDAOException e) { + throw new DeviceManagementException( + "Error occurred while fetching the Android device: '" + + deviceId.getId() + "'", e); + } + return device; + } - @Override - public boolean isClaimable(DeviceIdentifier deviceIdentifier) throws DeviceManagementException { - return false; - } + @Override + public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) + throws DeviceManagementException { + return true; + } - @Override - public boolean setStatus(DeviceIdentifier deviceIdentifier, String currentUser, - EnrolmentInfo.Status status) throws DeviceManagementException { - return false; - } + @Override + public boolean isClaimable(DeviceIdentifier deviceIdentifier) throws DeviceManagementException { + return false; + } + @Override + public boolean setStatus(DeviceIdentifier deviceIdentifier, String currentUser, + EnrolmentInfo.Status status) throws DeviceManagementException { + return false; + } - @Override - public License getLicense(String languageCode) throws LicenseManagementException { - return licenseManager.getLicense(AndroidDeviceManagementService.DEVICE_TYPE_ANDROID, languageCode); - } + @Override + public License getLicense(String languageCode) throws LicenseManagementException { + return licenseManager + .getLicense(AndroidDeviceManagementService.DEVICE_TYPE_ANDROID, languageCode); + } - @Override - public void addLicense(License license) throws LicenseManagementException { - licenseManager.addLicense(AndroidDeviceManagementService.DEVICE_TYPE_ANDROID, license); - } + @Override + public void addLicense(License license) throws LicenseManagementException { + licenseManager.addLicense(AndroidDeviceManagementService.DEVICE_TYPE_ANDROID, license); + } - @Override - public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) - throws DeviceManagementException { - boolean status; - Device existingDevice = this.getDevice(deviceIdentifier); - // This object holds the current persisted device object - MobileDevice existingMobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(existingDevice); + @Override + public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) + throws DeviceManagementException { + boolean status; + Device existingDevice = this.getDevice(deviceIdentifier); + // This object holds the current persisted device object + MobileDevice existingMobileDevice = + MobileDeviceManagementUtil.convertToMobileDevice(existingDevice); - // This object holds the newly received device object from response - MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); + // This object holds the newly received device object from response + MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); - // Updating current object features using newer ones - existingMobileDevice.setLatitude(mobileDevice.getLatitude()); - existingMobileDevice.setLongitude(mobileDevice.getLongitude()); - existingMobileDevice.setDeviceProperties(mobileDevice.getDeviceProperties()); + // Updating current object features using newer ones + existingMobileDevice.setLatitude(mobileDevice.getLatitude()); + existingMobileDevice.setLongitude(mobileDevice.getLongitude()); + existingMobileDevice.setDeviceProperties(mobileDevice.getDeviceProperties()); - try { - if (log.isDebugEnabled()) { - log.debug("updating the details of Android device : " + device.getDeviceIdentifier()); - } - AndroidDAOFactory.beginTransaction(); - status = daoFactory.getMobileDeviceDAO() - .updateMobileDevice(existingMobileDevice); - AndroidDAOFactory.commitTransaction(); - } catch (MobileDeviceManagementDAOException e) { - try { - AndroidDAOFactory.rollbackTransaction(); - } catch (MobileDeviceManagementDAOException e1) { - log.warn("Error occurred while roll back the update device info transaction : '" + - device.toString() + "'", e1); - } - throw new DeviceManagementException("Error occurred while updating the Android device: '" + - device.getDeviceIdentifier() + "'", e); - } - return status; - } + try { + if (log.isDebugEnabled()) { + log.debug( + "updating the details of Android device : " + device.getDeviceIdentifier()); + } + AndroidDAOFactory.beginTransaction(); + status = daoFactory.getMobileDeviceDAO() + .updateMobileDevice(existingMobileDevice); + AndroidDAOFactory.commitTransaction(); + } catch (MobileDeviceManagementDAOException e) { + try { + AndroidDAOFactory.rollbackTransaction(); + } catch (MobileDeviceManagementDAOException e1) { + log.warn("Error occurred while roll back the update device info transaction : '" + + device.toString() + "'", e1); + } + throw new DeviceManagementException( + "Error occurred while updating the Android device: '" + + device.getDeviceIdentifier() + "'", e); + } + return status; + } - @Override - public List getAllDevices() throws DeviceManagementException { - List devices = null; - try { - if (log.isDebugEnabled()) { - log.debug("Fetching the details of all Android devices"); - } - List mobileDevices = - daoFactory.getMobileDeviceDAO().getAllMobileDevices(); - if (mobileDevices != null) { - devices = new ArrayList<>(); - for (MobileDevice mobileDevice : mobileDevices) { - devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice)); - } - } - } catch (MobileDeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while fetching all Android devices", e); - } - return devices; - } + @Override + public List getAllDevices() throws DeviceManagementException { + List devices = null; + try { + if (log.isDebugEnabled()) { + log.debug("Fetching the details of all Android devices"); + } + List mobileDevices = + daoFactory.getMobileDeviceDAO().getAllMobileDevices(); + if (mobileDevices != null) { + devices = new ArrayList<>(); + for (MobileDevice mobileDevice : mobileDevices) { + devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice)); + } + } + } catch (MobileDeviceManagementDAOException e) { + throw new DeviceManagementException("Error occurred while fetching all Android devices", + e); + } + return devices; + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginConstants.java index 56837f259..3666d75f4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginConstants.java @@ -44,4 +44,6 @@ public class AndroidPluginConstants { public static final String ANDROID_FEATURE_NAME = "NAME"; public static final String ANDROID_FEATURE_DESCRIPTION = "DESCRIPTION"; + public static final String MEDIA_TYPE_XML = "application/xml"; + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java index 52cef6eab..72b9668b3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java @@ -31,7 +31,6 @@ import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.common.MobilePluginConstants; import org.wso2.carbon.device.mgt.mobile.dto.*; import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementDataHolder; -import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementDataHolder; import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.registry.core.Registry; @@ -260,12 +259,10 @@ public class MobileDeviceManagementUtil { String regPath = ""; switch (platform) { case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID: - regPath = MobilePluginConstants.MOBILE_CONFIG_REGISTRY_ROOT + "/" + - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID; + regPath = DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID; break; case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS: - regPath = MobilePluginConstants.MOBILE_CONFIG_REGISTRY_ROOT + "/" + - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS; + regPath = DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS; break; } return regPath;