Renaming TenantConfiguration as PlatformCongfiguration

revert-dabc3590
prabathabey 9 years ago
parent 03a21752e2
commit 6f7f706428

@ -25,7 +25,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager; import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
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.iot.androidsense.plugin.exception.AndroidSenseDeviceMgtPluginException; import org.wso2.carbon.device.mgt.iot.androidsense.plugin.exception.AndroidSenseDeviceMgtPluginException;
@ -49,14 +49,14 @@ public class AndroidSenseManager implements DeviceManager {
} }
@Override @Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) public boolean saveConfiguration(PlatformConfiguration PlatformConfiguration)
throws DeviceManagementException { throws DeviceManagementException {
//TODO implement this //TODO implement this
return false; return false;
} }
@Override @Override
public TenantConfiguration getConfiguration() throws DeviceManagementException { public PlatformConfiguration getConfiguration() throws DeviceManagementException {
//TODO implement this //TODO implement this
return null; return null;
} }

@ -27,7 +27,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager; import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
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.iot.arduino.plugin.exception.ArduinoDeviceMgtPluginException; import org.wso2.carbon.device.mgt.iot.arduino.plugin.exception.ArduinoDeviceMgtPluginException;
@ -51,14 +51,14 @@ public class ArduinoManager implements DeviceManager {
} }
@Override @Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) public boolean saveConfiguration(PlatformConfiguration PlatformConfiguration)
throws DeviceManagementException { throws DeviceManagementException {
//TODO implement this //TODO implement this
return false; return false;
} }
@Override @Override
public TenantConfiguration getConfiguration() throws DeviceManagementException { public PlatformConfiguration getConfiguration() throws DeviceManagementException {
//TODO implement this //TODO implement this
return null; return null;
} }

@ -26,7 +26,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager; import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
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.iot.raspberrypi.plugin.exception.RaspberrypiDeviceMgtPluginException; import org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.exception.RaspberrypiDeviceMgtPluginException;
@ -49,13 +49,13 @@ public class RaspberrypiManager implements DeviceManager {
} }
@Override @Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) public boolean saveConfiguration(PlatformConfiguration tenantConfiguration)
throws DeviceManagementException { throws DeviceManagementException {
return false; return false;
} }
@Override @Override
public TenantConfiguration getConfiguration() throws DeviceManagementException { public PlatformConfiguration getConfiguration() throws DeviceManagementException {
return null; return null;
} }

@ -26,7 +26,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager; import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
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.iot.virtualfirealarm.plugin.exception.VirtualFirealarmDeviceMgtPluginException; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.exception.VirtualFirealarmDeviceMgtPluginException;
@ -50,13 +50,13 @@ public class VirtualFireAlarmManager implements DeviceManager {
} }
@Override @Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) public boolean saveConfiguration(PlatformConfiguration PlatformConfiguration)
throws DeviceManagementException { throws DeviceManagementException {
return false; return false;
} }
@Override @Override
public TenantConfiguration getConfiguration() throws DeviceManagementException { public PlatformConfiguration getConfiguration() throws DeviceManagementException {
return null; return null;
} }

@ -19,7 +19,7 @@
package org.wso2.carbon.mdm.services.android.services.configuration; package org.wso2.carbon.mdm.services.android.services.configuration;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException; import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
@ -46,14 +46,14 @@ public interface ConfigurationMgtService {
@ApiResponse(code = 500, message = "Internal Server Error") @ApiResponse(code = 500, message = "Internal Server Error")
}) })
Response configureSettings(@ApiParam(name = "configuration", value = "AndroidPlatformConfiguration") Response configureSettings(@ApiParam(name = "configuration", value = "AndroidPlatformConfiguration")
TenantConfiguration configuration) throws AndroidAgentException; PlatformConfiguration configuration) throws AndroidAgentException;
@GET @GET
@ApiOperation( @ApiOperation(
httpMethod = "GET", httpMethod = "GET",
value = "Getting Android Platform Configurations", value = "Getting Android Platform Configurations",
notes = "Get the Android platform configuration details using this REST API", notes = "Get the Android platform configuration details using this REST API",
response = TenantConfiguration.class response = PlatformConfiguration.class
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Get Android Configurations"), @ApiResponse(code = 200, message = "Get Android Configurations"),
@ -75,5 +75,5 @@ public interface ConfigurationMgtService {
"Android platform") "Android platform")
}) })
Response updateConfiguration(@ApiParam(name = "configuration", value = "AndroidPlatformConfiguration") Response updateConfiguration(@ApiParam(name = "configuration", value = "AndroidPlatformConfiguration")
TenantConfiguration configuration) throws AndroidAgentException; PlatformConfiguration configuration) throws AndroidAgentException;
} }

@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; 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.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException; import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException;
import org.wso2.carbon.mdm.services.android.services.configuration.ConfigurationMgtService; import org.wso2.carbon.mdm.services.android.services.configuration.ConfigurationMgtService;
@ -45,7 +45,7 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
private static Log log = LogFactory.getLog(ConfigurationMgtServiceImpl.class); private static Log log = LogFactory.getLog(ConfigurationMgtServiceImpl.class);
@POST @POST
public Response configureSettings(TenantConfiguration configuration) public Response configureSettings(PlatformConfiguration configuration)
throws AndroidAgentException { throws AndroidAgentException {
Message responseMsg = new Message(); Message responseMsg = new Message();
@ -87,15 +87,15 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
@GET @GET
public Response getConfiguration() throws AndroidAgentException { public Response getConfiguration() throws AndroidAgentException {
String msg; String msg;
TenantConfiguration tenantConfiguration = null; PlatformConfiguration PlatformConfiguration = null;
List<ConfigurationEntry> configs; List<ConfigurationEntry> configs;
try { try {
tenantConfiguration = AndroidAPIUtils.getDeviceManagementService(). PlatformConfiguration = AndroidAPIUtils.getDeviceManagementService().
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
if (tenantConfiguration != null) { if (PlatformConfiguration != null) {
configs = tenantConfiguration.getConfiguration(); configs = PlatformConfiguration.getConfiguration();
} else { } else {
tenantConfiguration = new TenantConfiguration(); PlatformConfiguration = new PlatformConfiguration();
configs = new ArrayList<>(); configs = new ArrayList<>();
} }
@ -109,18 +109,18 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
entry.setName(AndroidConstants.TenantConfigProperties.LICENSE_KEY); entry.setName(AndroidConstants.TenantConfigProperties.LICENSE_KEY);
entry.setValue(license.getText()); entry.setValue(license.getText());
configs.add(entry); configs.add(entry);
tenantConfiguration.setConfiguration(configs); PlatformConfiguration.setConfiguration(configs);
} }
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
msg = "Error occurred while retrieving the Android tenant configuration"; msg = "Error occurred while retrieving the Android tenant configuration";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
return Response.status(Response.Status.OK).entity(tenantConfiguration).build(); return Response.status(Response.Status.OK).entity(PlatformConfiguration).build();
} }
@PUT @PUT
public Response updateConfiguration(TenantConfiguration configuration) throws AndroidAgentException { public Response updateConfiguration(PlatformConfiguration configuration) throws AndroidAgentException {
String msg; String msg;
Message responseMsg = new Message(); Message responseMsg = new Message();
ConfigurationEntry licenseEntry = null; ConfigurationEntry licenseEntry = null;
@ -145,7 +145,7 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
} }
configuration.setConfiguration(configs); configuration.setConfiguration(configs);
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration); AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
AndroidAPIUtils.getGCMService().resetTenantConfigCache(); //AndroidAPIUtils.getGCMService().resetTenantConfigCache();
Response.status(Response.Status.ACCEPTED); Response.status(Response.Status.ACCEPTED);
responseMsg.setResponseMessage("Android platform configuration has updated successfully."); responseMsg.setResponseMessage("Android platform configuration has updated successfully.");
responseMsg.setResponseCode(Response.Status.ACCEPTED.toString()); responseMsg.setResponseCode(Response.Status.ACCEPTED.toString());

@ -46,7 +46,6 @@ import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtExcept
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager;
import org.wso2.carbon.device.mgt.core.search.mgt.impl.Utils; import org.wso2.carbon.device.mgt.core.search.mgt.impl.Utils;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.mobile.impl.android.gcm.GCMService;
import org.wso2.carbon.mdm.services.android.bean.DeviceState; import org.wso2.carbon.mdm.services.android.bean.DeviceState;
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException; import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
@ -94,16 +93,16 @@ public class AndroidAPIUtils {
return deviceManagementProviderService; return deviceManagementProviderService;
} }
public static GCMService getGCMService() { // public static GCMService getGCMService() {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); // PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
GCMService gcmService = (GCMService) ctx.getOSGiService(GCMService.class, null); // GCMService gcmService = (GCMService) ctx.getOSGiService(GCMService.class, null);
if (gcmService == null) { // if (gcmService == null) {
String msg = "GCM service has not initialized."; // String msg = "GCM service has not initialized.";
log.error(msg); // log.error(msg);
throw new IllegalStateException(msg); // throw new IllegalStateException(msg);
} // }
return gcmService; // return gcmService;
} // }
public static MediaType getResponseMediaType(String acceptHeader) { public static MediaType getResponseMediaType(String acceptHeader) {
MediaType responseMediaType; MediaType responseMediaType;
@ -126,17 +125,17 @@ public class AndroidAPIUtils {
List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList(); List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList();
Activity activity = getDeviceManagementService().addOperation( Activity activity = getDeviceManagementService().addOperation(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, operation, validDeviceIds); DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, operation, validDeviceIds);
if (activity != null) { // if (activity != null) {
GCMService gcmService = getGCMService(); // GCMService gcmService = getGCMService();
if (gcmService.isGCMEnabled()) { // if (gcmService.isGCMEnabled()) {
List<DeviceIdentifier> deviceIDList = deviceIDHolder.getValidDeviceIDList(); // List<DeviceIdentifier> deviceIDList = deviceIDHolder.getValidDeviceIDList();
List<Device> devices = new ArrayList<Device>(deviceIDList.size()); // List<Device> devices = new ArrayList<Device>(deviceIDList.size());
for (DeviceIdentifier deviceIdentifier : deviceIDList) { // for (DeviceIdentifier deviceIdentifier : deviceIDList) {
devices.add(getDeviceManagementService().getDevice(deviceIdentifier)); // devices.add(getDeviceManagementService().getDevice(deviceIdentifier));
} // }
getGCMService().sendNotification(operation.getCode(), devices); // getGCMService().sendNotification(operation.getCode(), devices);
} // }
} // }
if (!deviceIDHolder.getErrorDeviceIdList().isEmpty()) { if (!deviceIDHolder.getErrorDeviceIdList().isEmpty()) {
return javax.ws.rs.core.Response.status(AndroidConstants.StatusCodes. return javax.ws.rs.core.Response.status(AndroidConstants.StatusCodes.
MULTI_STATUS_HTTP_CODE).type( MULTI_STATUS_HTTP_CODE).type(

@ -27,7 +27,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager; import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
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.license.mgt.LicenseManager; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
@ -85,7 +85,7 @@ public class AndroidDeviceManager implements DeviceManager {
} }
@Override @Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) public boolean saveConfiguration(PlatformConfiguration tenantConfiguration)
throws DeviceManagementException { throws DeviceManagementException {
boolean status; boolean status;
try { try {
@ -96,7 +96,7 @@ public class AndroidDeviceManager implements DeviceManager {
DeviceManagementConstants. DeviceManagementConstants.
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
Marshaller marshaller = context.createMarshaller(); Marshaller marshaller = context.createMarshaller();
marshaller.marshal(tenantConfiguration, writer); marshaller.marshal(tenantConfiguration, writer);
@ -119,7 +119,7 @@ public class AndroidDeviceManager implements DeviceManager {
} }
@Override @Override
public TenantConfiguration getConfiguration() throws DeviceManagementException { public PlatformConfiguration getConfiguration() throws DeviceManagementException {
Resource resource; Resource resource;
try { try {
String androidRegPath = String androidRegPath =
@ -127,9 +127,9 @@ public class AndroidDeviceManager implements DeviceManager {
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
resource = MobileDeviceManagementUtil.getRegistryResource(androidRegPath); resource = MobileDeviceManagementUtil.getRegistryResource(androidRegPath);
if (resource != null) { if (resource != null) {
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
Unmarshaller unmarshaller = context.createUnmarshaller(); Unmarshaller unmarshaller = context.createUnmarshaller();
return (TenantConfiguration) unmarshaller.unmarshal( return (PlatformConfiguration) unmarshaller.unmarshal(
new StringReader(new String((byte[]) resource.getContent(), Charset. new StringReader(new String((byte[]) resource.getContent(), Charset.
forName(MobilePluginConstants.CHARSET_UTF8)))); forName(MobilePluginConstants.CHARSET_UTF8))));
} }

@ -27,7 +27,7 @@ import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; 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.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.mobile.android.impl.util.AndroidPluginConstants; import org.wso2.carbon.device.mgt.mobile.android.impl.util.AndroidPluginConstants;
import org.wso2.carbon.device.mgt.mobile.android.internal.AndroidDeviceManagementDataHolder; import org.wso2.carbon.device.mgt.mobile.android.internal.AndroidDeviceManagementDataHolder;
@ -56,7 +56,7 @@ public class GCMUtil {
private static final int TIME_TO_LIVE = 60; private static final int TIME_TO_LIVE = 60;
private static final int HTTP_STATUS_CODE_OK = 200; private static final int HTTP_STATUS_CODE_OK = 200;
private static HashMap<Integer,TenantConfiguration> tenantConfigurationCache = new HashMap<>(); private static HashMap<Integer, PlatformConfiguration> tenantConfigurationCache = new HashMap<>();
public static GCMResult sendWakeUpCall(String message, List<Device> devices) { public static GCMResult sendWakeUpCall(String message, List<Device> devices) {
GCMResult result = new GCMResult(); GCMResult result = new GCMResult();
@ -163,7 +163,7 @@ public class GCMUtil {
getAndroidDeviceManagementService(); getAndroidDeviceManagementService();
try { try {
//Get the TenantConfiguration from cache if not we'll get it from DM service //Get the TenantConfiguration from cache if not we'll get it from DM service
TenantConfiguration tenantConfiguration = getTenantConfigurationFromCache(); PlatformConfiguration tenantConfiguration = getTenantConfigurationFromCache();
if (tenantConfiguration == null) { if (tenantConfiguration == null) {
tenantConfiguration = androidDMService.getDeviceManager().getConfiguration(); tenantConfiguration = androidDMService.getDeviceManager().getConfiguration();
if (tenantConfiguration != null) { if (tenantConfiguration != null) {
@ -190,11 +190,11 @@ public class GCMUtil {
tenantConfigurationCache.remove(getTenantId()); tenantConfigurationCache.remove(getTenantId());
} }
private static void addTenantConfigurationToCache(TenantConfiguration tenantConfiguration) { private static void addTenantConfigurationToCache(PlatformConfiguration tenantConfiguration) {
tenantConfigurationCache.put(getTenantId(), tenantConfiguration); tenantConfigurationCache.put(getTenantId(), tenantConfiguration);
} }
private static TenantConfiguration getTenantConfigurationFromCache() { private static PlatformConfiguration getTenantConfigurationFromCache() {
return tenantConfigurationCache.get(getTenantId()); return tenantConfigurationCache.get(getTenantId());
} }

@ -21,7 +21,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.android;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
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.license.mgt.LicenseManager; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
@ -79,7 +79,7 @@ public class AndroidDeviceManager implements DeviceManager {
} }
@Override @Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) public boolean saveConfiguration(PlatformConfiguration tenantConfiguration)
throws DeviceManagementException { throws DeviceManagementException {
boolean status; boolean status;
try { try {
@ -90,7 +90,7 @@ public class AndroidDeviceManager implements DeviceManager {
DeviceManagementConstants. DeviceManagementConstants.
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
Marshaller marshaller = context.createMarshaller(); Marshaller marshaller = context.createMarshaller();
marshaller.marshal(tenantConfiguration, writer); marshaller.marshal(tenantConfiguration, writer);
@ -113,7 +113,7 @@ public class AndroidDeviceManager implements DeviceManager {
} }
@Override @Override
public TenantConfiguration getConfiguration() throws DeviceManagementException { public PlatformConfiguration getConfiguration() throws DeviceManagementException {
Resource resource; Resource resource;
try { try {
String androidRegPath = String androidRegPath =
@ -121,9 +121,9 @@ public class AndroidDeviceManager implements DeviceManager {
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
resource = MobileDeviceManagementUtil.getRegistryResource(androidRegPath); resource = MobileDeviceManagementUtil.getRegistryResource(androidRegPath);
if (resource != null) { if (resource != null) {
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
Unmarshaller unmarshaller = context.createUnmarshaller(); Unmarshaller unmarshaller = context.createUnmarshaller();
return (TenantConfiguration) unmarshaller.unmarshal( return (PlatformConfiguration) unmarshaller.unmarshal(
new StringReader(new String((byte[]) resource.getContent(), Charset. new StringReader(new String((byte[]) resource.getContent(), Charset.
forName(MobilePluginConstants.CHARSET_UTF8)))); forName(MobilePluginConstants.CHARSET_UTF8))));
} }

@ -25,7 +25,7 @@ import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; 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.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.mobile.impl.android.util.AndroidPluginConstants; import org.wso2.carbon.device.mgt.mobile.impl.android.util.AndroidPluginConstants;
import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementDataHolder; import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementDataHolder;
@ -50,7 +50,7 @@ public class GCMUtil {
private static final int TIME_TO_LIVE = 60; private static final int TIME_TO_LIVE = 60;
private static final int HTTP_STATUS_CODE_OK = 200; private static final int HTTP_STATUS_CODE_OK = 200;
private static HashMap<Integer,TenantConfiguration> tenantConfigurationCache = new HashMap<>(); private static HashMap<Integer, PlatformConfiguration> tenantConfigurationCache = new HashMap<>();
public static GCMResult sendWakeUpCall(String message, List<Device> devices) { public static GCMResult sendWakeUpCall(String message, List<Device> devices) {
GCMResult result = new GCMResult(); GCMResult result = new GCMResult();
@ -157,7 +157,7 @@ public class GCMUtil {
getAndroidDeviceManagementService(); getAndroidDeviceManagementService();
try { try {
//Get the TenantConfiguration from cache if not we'll get it from DM service //Get the TenantConfiguration from cache if not we'll get it from DM service
TenantConfiguration tenantConfiguration = getTenantConfigurationFromCache(); PlatformConfiguration tenantConfiguration = getTenantConfigurationFromCache();
if (tenantConfiguration == null) { if (tenantConfiguration == null) {
tenantConfiguration = androidDMService.getDeviceManager().getConfiguration(); tenantConfiguration = androidDMService.getDeviceManager().getConfiguration();
if (tenantConfiguration != null) { if (tenantConfiguration != null) {
@ -184,11 +184,11 @@ public class GCMUtil {
tenantConfigurationCache.remove(getTenantId()); tenantConfigurationCache.remove(getTenantId());
} }
private static void addTenantConfigurationToCache(TenantConfiguration tenantConfiguration) { private static void addTenantConfigurationToCache(PlatformConfiguration tenantConfiguration) {
tenantConfigurationCache.put(getTenantId(), tenantConfiguration); tenantConfigurationCache.put(getTenantId(), tenantConfiguration);
} }
private static TenantConfiguration getTenantConfigurationFromCache() { private static PlatformConfiguration getTenantConfigurationFromCache() {
return tenantConfigurationCache.get(getTenantId()); return tenantConfigurationCache.get(getTenantId());
} }

@ -21,7 +21,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.windows;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
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.license.mgt.LicenseManager; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
@ -79,7 +79,7 @@ public class WindowsDeviceManager implements DeviceManager {
} }
@Override @Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) throws DeviceManagementException { public boolean saveConfiguration(PlatformConfiguration tenantConfiguration) throws DeviceManagementException {
boolean status; boolean status;
Resource resource; Resource resource;
try { try {
@ -89,7 +89,7 @@ public class WindowsDeviceManager implements DeviceManager {
String resourcePath = MobileDeviceManagementUtil.getPlatformConfigPath( String resourcePath = MobileDeviceManagementUtil.getPlatformConfigPath(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
Marshaller marshaller = context.createMarshaller(); Marshaller marshaller = context.createMarshaller();
marshaller.marshal(tenantConfiguration, writer); marshaller.marshal(tenantConfiguration, writer);
@ -112,16 +112,16 @@ public class WindowsDeviceManager implements DeviceManager {
} }
@Override @Override
public TenantConfiguration getConfiguration() throws DeviceManagementException { public PlatformConfiguration getConfiguration() throws DeviceManagementException {
Resource resource; Resource resource;
try { try {
String windowsTenantRegistryPath = MobileDeviceManagementUtil. String windowsTenantRegistryPath = MobileDeviceManagementUtil.
getPlatformConfigPath(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); getPlatformConfigPath(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
resource = MobileDeviceManagementUtil.getRegistryResource(windowsTenantRegistryPath); resource = MobileDeviceManagementUtil.getRegistryResource(windowsTenantRegistryPath);
if (resource != null) { if (resource != null) {
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
Unmarshaller unmarshaller = context.createUnmarshaller(); Unmarshaller unmarshaller = context.createUnmarshaller();
return (TenantConfiguration) unmarshaller.unmarshal(new StringReader( return (PlatformConfiguration) unmarshaller.unmarshal(new StringReader(
new String((byte[]) resource.getContent(), Charset. new String((byte[]) resource.getContent(), Charset.
forName(MobilePluginConstants.CHARSET_UTF8)))); forName(MobilePluginConstants.CHARSET_UTF8))));
} }

@ -27,7 +27,7 @@ import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
@ -165,7 +165,7 @@ public class WindowsAPIUtils {
getDeviceManagementService().updateOperation(deviceIdentifier, operation); getDeviceManagementService().updateOperation(deviceIdentifier, operation);
} }
public static TenantConfiguration getTenantConfiguration() throws DeviceManagementException { public static PlatformConfiguration getTenantConfiguration() throws DeviceManagementException {
return getDeviceManagementService().getConfiguration( return getDeviceManagementService().getConfiguration(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
} }

@ -21,7 +21,7 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.configurationmgtserv
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message;
@ -56,7 +56,7 @@ public interface ConfigurationMgtService {
@ApiResponse(code = 201, message = "Windows platform configuration saved successfully"), @ApiResponse(code = 201, message = "Windows platform configuration saved successfully"),
@ApiResponse(code = 500, message = "Internal Server Error") @ApiResponse(code = 500, message = "Internal Server Error")
}) })
Message ConfigureSettings(TenantConfiguration configuration) throws WindowsConfigurationException; Message ConfigureSettings(PlatformConfiguration configuration) throws WindowsConfigurationException;
/** /**
* Retrieve Tenant configurations according to the device type. * Retrieve Tenant configurations according to the device type.
@ -69,13 +69,13 @@ public interface ConfigurationMgtService {
httpMethod = "GET", httpMethod = "GET",
value = "Getting Windows Platform Configurations", value = "Getting Windows Platform Configurations",
notes = "Get the Windows platform configuration details using this REST API", notes = "Get the Windows platform configuration details using this REST API",
response = TenantConfiguration.class response = PlatformConfiguration.class
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Get Windows Configurations"), @ApiResponse(code = 200, message = "Get Windows Configurations"),
@ApiResponse(code = 500, message = "Server Error") @ApiResponse(code = 500, message = "Server Error")
}) })
TenantConfiguration getConfiguration() throws WindowsConfigurationException; PlatformConfiguration getConfiguration() throws WindowsConfigurationException;
/** /**
* Update Tenant Configurations for the specific Device type. * Update Tenant Configurations for the specific Device type.
@ -97,5 +97,5 @@ public interface ConfigurationMgtService {
@ApiResponse(code = 500, message = "Error occurred while modifying configuration settings of " + @ApiResponse(code = 500, message = "Error occurred while modifying configuration settings of " +
"windows platform") "windows platform")
}) })
Message updateConfiguration(TenantConfiguration configuration) throws WindowsConfigurationException; Message updateConfiguration(PlatformConfiguration configuration) throws WindowsConfigurationException;
} }

@ -23,7 +23,8 @@ import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; 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.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.mdm.mobileservices.windows.common.PluginConstants; import org.wso2.carbon.mdm.mobileservices.windows.common.PluginConstants;
import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException;
@ -54,7 +55,7 @@ public class ConfigurationMgtServiceImpl {
* @throws WindowsConfigurationException * @throws WindowsConfigurationException
*/ */
@POST @POST
public Message ConfigureSettings(TenantConfiguration configuration) throws WindowsConfigurationException { public Message ConfigureSettings(PlatformConfiguration configuration) throws WindowsConfigurationException {
Message responseMsg = new Message(); Message responseMsg = new Message();
ConfigurationEntry licenseEntry = null; ConfigurationEntry licenseEntry = null;
String message; String message;
@ -106,15 +107,15 @@ public class ConfigurationMgtServiceImpl {
* @throws WindowsConfigurationException * @throws WindowsConfigurationException
*/ */
@GET @GET
public TenantConfiguration getConfiguration() throws WindowsConfigurationException { public PlatformConfiguration getConfiguration() throws WindowsConfigurationException {
String msg; String msg;
TenantConfiguration tenantConfiguration = null; PlatformConfiguration PlatformConfiguration = null;
try { try {
if (WindowsAPIUtils.getDeviceManagementService(). if (WindowsAPIUtils.getDeviceManagementService().
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS) != null) { getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS) != null) {
tenantConfiguration = WindowsAPIUtils.getDeviceManagementService(). PlatformConfiguration = WindowsAPIUtils.getDeviceManagementService().
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
List<ConfigurationEntry> configs = tenantConfiguration.getConfiguration(); List<ConfigurationEntry> configs = PlatformConfiguration.getConfiguration();
ConfigurationEntry entry = new ConfigurationEntry(); ConfigurationEntry entry = new ConfigurationEntry();
License license = WindowsAPIUtils.getDeviceManagementService().getLicense( License license = WindowsAPIUtils.getDeviceManagementService().getLicense(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, PluginConstants. DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, PluginConstants.
@ -124,7 +125,7 @@ public class ConfigurationMgtServiceImpl {
entry.setName(PluginConstants.TenantConfigProperties.LICENSE_KEY); entry.setName(PluginConstants.TenantConfigProperties.LICENSE_KEY);
entry.setValue(license.getText()); entry.setValue(license.getText());
configs.add(entry); configs.add(entry);
tenantConfiguration.setConfiguration(configs); PlatformConfiguration.setConfiguration(configs);
} }
} }
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
@ -132,7 +133,7 @@ public class ConfigurationMgtServiceImpl {
log.error(msg, e); log.error(msg, e);
throw new WindowsConfigurationException(msg, e); throw new WindowsConfigurationException(msg, e);
} }
return tenantConfiguration; return PlatformConfiguration;
} }
/** /**
@ -143,7 +144,7 @@ public class ConfigurationMgtServiceImpl {
* @throws WindowsConfigurationException * @throws WindowsConfigurationException
*/ */
@PUT @PUT
public Message updateConfiguration(TenantConfiguration configuration) throws WindowsConfigurationException { public Message updateConfiguration(PlatformConfiguration configuration) throws WindowsConfigurationException {
String message; String message;
Message responseMsg = new Message(); Message responseMsg = new Message();
ConfigurationEntry licenseEntry = null; ConfigurationEntry licenseEntry = null;

@ -32,7 +32,7 @@ import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; 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.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.mdm.mobileservices.windows.common.PluginConstants; import org.wso2.carbon.mdm.mobileservices.windows.common.PluginConstants;
import org.wso2.carbon.mdm.mobileservices.windows.common.beans.CacheEntry; import org.wso2.carbon.mdm.mobileservices.windows.common.beans.CacheEntry;
import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.CertificateGenerationException; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.CertificateGenerationException;
@ -372,7 +372,7 @@ public class CertificateEnrollmentServiceImpl implements CertificateEnrollmentSe
*/ */
private List<ConfigurationEntry> getTenantConfigurationData() throws DeviceManagementException { private List<ConfigurationEntry> getTenantConfigurationData() throws DeviceManagementException {
if (WindowsAPIUtils.getTenantConfiguration() != null) { if (WindowsAPIUtils.getTenantConfiguration() != null) {
TenantConfiguration configuration = WindowsAPIUtils.getTenantConfiguration(); PlatformConfiguration configuration = WindowsAPIUtils.getTenantConfiguration();
return configuration.getConfiguration(); return configuration.getConfiguration();
} else { } else {
return null; return null;

@ -21,7 +21,7 @@ package org.wso2.carbon.device.mgt.mobile.windows.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
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.license.mgt.LicenseManager; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
@ -79,7 +79,7 @@ public class WindowsDeviceManager implements DeviceManager {
} }
@Override @Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) public boolean saveConfiguration(PlatformConfiguration tenantConfiguration)
throws DeviceManagementException { throws DeviceManagementException {
boolean status; boolean status;
Resource resource; Resource resource;
@ -91,7 +91,7 @@ public class WindowsDeviceManager implements DeviceManager {
DeviceManagementConstants. DeviceManagementConstants.
MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
Marshaller marshaller = context.createMarshaller(); Marshaller marshaller = context.createMarshaller();
marshaller.marshal(tenantConfiguration, writer); marshaller.marshal(tenantConfiguration, writer);
@ -114,7 +114,7 @@ public class WindowsDeviceManager implements DeviceManager {
} }
@Override @Override
public TenantConfiguration getConfiguration() throws DeviceManagementException { public PlatformConfiguration getConfiguration() throws DeviceManagementException {
Resource resource; Resource resource;
try { try {
String windowsTenantRegistryPath = String windowsTenantRegistryPath =
@ -122,9 +122,9 @@ public class WindowsDeviceManager implements DeviceManager {
MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
resource = MobileDeviceManagementUtil.getRegistryResource(windowsTenantRegistryPath); resource = MobileDeviceManagementUtil.getRegistryResource(windowsTenantRegistryPath);
if (resource != null) { if (resource != null) {
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
Unmarshaller unmarshaller = context.createUnmarshaller(); Unmarshaller unmarshaller = context.createUnmarshaller();
return (TenantConfiguration) unmarshaller.unmarshal( return (PlatformConfiguration) unmarshaller.unmarshal(
new StringReader(new String((byte[]) resource.getContent(), Charset. new StringReader(new String((byte[]) resource.getContent(), Charset.
forName(MobilePluginConstants.CHARSET_UTF8)))); forName(MobilePluginConstants.CHARSET_UTF8))));
} }

Loading…
Cancel
Save