mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Renaming TenantConfiguration as PlatformCongfiguration
This commit is contained in:
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.EnrolmentInfo;
|
||||
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.LicenseManagementException;
|
||||
import org.wso2.carbon.device.mgt.iot.androidsense.plugin.exception.AndroidSenseDeviceMgtPluginException;
|
||||
@ -49,14 +49,14 @@ public class AndroidSenseManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveConfiguration(TenantConfiguration tenantConfiguration)
|
||||
public boolean saveConfiguration(PlatformConfiguration PlatformConfiguration)
|
||||
throws DeviceManagementException {
|
||||
//TODO implement this
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantConfiguration getConfiguration() throws DeviceManagementException {
|
||||
public PlatformConfiguration getConfiguration() throws DeviceManagementException {
|
||||
//TODO implement this
|
||||
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.EnrolmentInfo;
|
||||
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.LicenseManagementException;
|
||||
import org.wso2.carbon.device.mgt.iot.arduino.plugin.exception.ArduinoDeviceMgtPluginException;
|
||||
@ -51,14 +51,14 @@ public class ArduinoManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveConfiguration(TenantConfiguration tenantConfiguration)
|
||||
public boolean saveConfiguration(PlatformConfiguration PlatformConfiguration)
|
||||
throws DeviceManagementException {
|
||||
//TODO implement this
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantConfiguration getConfiguration() throws DeviceManagementException {
|
||||
public PlatformConfiguration getConfiguration() throws DeviceManagementException {
|
||||
//TODO implement this
|
||||
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.EnrolmentInfo;
|
||||
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.LicenseManagementException;
|
||||
import org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.exception.RaspberrypiDeviceMgtPluginException;
|
||||
@ -49,13 +49,13 @@ public class RaspberrypiManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveConfiguration(TenantConfiguration tenantConfiguration)
|
||||
public boolean saveConfiguration(PlatformConfiguration tenantConfiguration)
|
||||
throws DeviceManagementException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantConfiguration getConfiguration() throws DeviceManagementException {
|
||||
public PlatformConfiguration getConfiguration() throws DeviceManagementException {
|
||||
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.EnrolmentInfo;
|
||||
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.LicenseManagementException;
|
||||
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.exception.VirtualFirealarmDeviceMgtPluginException;
|
||||
@ -50,13 +50,13 @@ public class VirtualFireAlarmManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveConfiguration(TenantConfiguration tenantConfiguration)
|
||||
public boolean saveConfiguration(PlatformConfiguration PlatformConfiguration)
|
||||
throws DeviceManagementException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantConfiguration getConfiguration() throws DeviceManagementException {
|
||||
public PlatformConfiguration getConfiguration() throws DeviceManagementException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
package org.wso2.carbon.mdm.services.android.services.configuration;
|
||||
|
||||
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 javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
@ -46,14 +46,14 @@ public interface ConfigurationMgtService {
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")
|
||||
})
|
||||
Response configureSettings(@ApiParam(name = "configuration", value = "AndroidPlatformConfiguration")
|
||||
TenantConfiguration configuration) throws AndroidAgentException;
|
||||
PlatformConfiguration configuration) throws AndroidAgentException;
|
||||
|
||||
@GET
|
||||
@ApiOperation(
|
||||
httpMethod = "GET",
|
||||
value = "Getting Android Platform Configurations",
|
||||
notes = "Get the Android platform configuration details using this REST API",
|
||||
response = TenantConfiguration.class
|
||||
response = PlatformConfiguration.class
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Get Android Configurations"),
|
||||
@ -75,5 +75,5 @@ public interface ConfigurationMgtService {
|
||||
"Android platform")
|
||||
})
|
||||
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.DeviceManagementException;
|
||||
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.mdm.services.android.exception.AndroidAgentException;
|
||||
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);
|
||||
|
||||
@POST
|
||||
public Response configureSettings(TenantConfiguration configuration)
|
||||
public Response configureSettings(PlatformConfiguration configuration)
|
||||
throws AndroidAgentException {
|
||||
|
||||
Message responseMsg = new Message();
|
||||
@ -87,15 +87,15 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
|
||||
@GET
|
||||
public Response getConfiguration() throws AndroidAgentException {
|
||||
String msg;
|
||||
TenantConfiguration tenantConfiguration = null;
|
||||
PlatformConfiguration PlatformConfiguration = null;
|
||||
List<ConfigurationEntry> configs;
|
||||
try {
|
||||
tenantConfiguration = AndroidAPIUtils.getDeviceManagementService().
|
||||
PlatformConfiguration = AndroidAPIUtils.getDeviceManagementService().
|
||||
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
||||
if (tenantConfiguration != null) {
|
||||
configs = tenantConfiguration.getConfiguration();
|
||||
if (PlatformConfiguration != null) {
|
||||
configs = PlatformConfiguration.getConfiguration();
|
||||
} else {
|
||||
tenantConfiguration = new TenantConfiguration();
|
||||
PlatformConfiguration = new PlatformConfiguration();
|
||||
configs = new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -109,18 +109,18 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
|
||||
entry.setName(AndroidConstants.TenantConfigProperties.LICENSE_KEY);
|
||||
entry.setValue(license.getText());
|
||||
configs.add(entry);
|
||||
tenantConfiguration.setConfiguration(configs);
|
||||
PlatformConfiguration.setConfiguration(configs);
|
||||
}
|
||||
} catch (DeviceManagementException e) {
|
||||
msg = "Error occurred while retrieving the Android tenant configuration";
|
||||
log.error(msg, e);
|
||||
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
|
||||
public Response updateConfiguration(TenantConfiguration configuration) throws AndroidAgentException {
|
||||
public Response updateConfiguration(PlatformConfiguration configuration) throws AndroidAgentException {
|
||||
String msg;
|
||||
Message responseMsg = new Message();
|
||||
ConfigurationEntry licenseEntry = null;
|
||||
@ -145,7 +145,7 @@ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
|
||||
}
|
||||
configuration.setConfiguration(configs);
|
||||
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
|
||||
AndroidAPIUtils.getGCMService().resetTenantConfigCache();
|
||||
//AndroidAPIUtils.getGCMService().resetTenantConfigCache();
|
||||
Response.status(Response.Status.ACCEPTED);
|
||||
responseMsg.setResponseMessage("Android platform configuration has updated successfully.");
|
||||
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.search.mgt.impl.Utils;
|
||||
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.policy.mgt.common.monitor.PolicyComplianceException;
|
||||
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
|
||||
@ -94,16 +93,16 @@ public class AndroidAPIUtils {
|
||||
return deviceManagementProviderService;
|
||||
}
|
||||
|
||||
public static GCMService getGCMService() {
|
||||
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||
GCMService gcmService = (GCMService) ctx.getOSGiService(GCMService.class, null);
|
||||
if (gcmService == null) {
|
||||
String msg = "GCM service has not initialized.";
|
||||
log.error(msg);
|
||||
throw new IllegalStateException(msg);
|
||||
}
|
||||
return gcmService;
|
||||
}
|
||||
// public static GCMService getGCMService() {
|
||||
// PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||
// GCMService gcmService = (GCMService) ctx.getOSGiService(GCMService.class, null);
|
||||
// if (gcmService == null) {
|
||||
// String msg = "GCM service has not initialized.";
|
||||
// log.error(msg);
|
||||
// throw new IllegalStateException(msg);
|
||||
// }
|
||||
// return gcmService;
|
||||
// }
|
||||
|
||||
public static MediaType getResponseMediaType(String acceptHeader) {
|
||||
MediaType responseMediaType;
|
||||
@ -126,17 +125,17 @@ public class AndroidAPIUtils {
|
||||
List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList();
|
||||
Activity activity = getDeviceManagementService().addOperation(
|
||||
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, operation, validDeviceIds);
|
||||
if (activity != null) {
|
||||
GCMService gcmService = getGCMService();
|
||||
if (gcmService.isGCMEnabled()) {
|
||||
List<DeviceIdentifier> deviceIDList = deviceIDHolder.getValidDeviceIDList();
|
||||
List<Device> devices = new ArrayList<Device>(deviceIDList.size());
|
||||
for (DeviceIdentifier deviceIdentifier : deviceIDList) {
|
||||
devices.add(getDeviceManagementService().getDevice(deviceIdentifier));
|
||||
}
|
||||
getGCMService().sendNotification(operation.getCode(), devices);
|
||||
}
|
||||
}
|
||||
// if (activity != null) {
|
||||
// GCMService gcmService = getGCMService();
|
||||
// if (gcmService.isGCMEnabled()) {
|
||||
// List<DeviceIdentifier> deviceIDList = deviceIDHolder.getValidDeviceIDList();
|
||||
// List<Device> devices = new ArrayList<Device>(deviceIDList.size());
|
||||
// for (DeviceIdentifier deviceIdentifier : deviceIDList) {
|
||||
// devices.add(getDeviceManagementService().getDevice(deviceIdentifier));
|
||||
// }
|
||||
// getGCMService().sendNotification(operation.getCode(), devices);
|
||||
// }
|
||||
// }
|
||||
if (!deviceIDHolder.getErrorDeviceIdList().isEmpty()) {
|
||||
return javax.ws.rs.core.Response.status(AndroidConstants.StatusCodes.
|
||||
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.EnrolmentInfo;
|
||||
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.LicenseManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
|
||||
@ -85,7 +85,7 @@ public class AndroidDeviceManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveConfiguration(TenantConfiguration tenantConfiguration)
|
||||
public boolean saveConfiguration(PlatformConfiguration tenantConfiguration)
|
||||
throws DeviceManagementException {
|
||||
boolean status;
|
||||
try {
|
||||
@ -96,7 +96,7 @@ public class AndroidDeviceManager implements DeviceManager {
|
||||
DeviceManagementConstants.
|
||||
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
||||
StringWriter writer = new StringWriter();
|
||||
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
|
||||
JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
|
||||
Marshaller marshaller = context.createMarshaller();
|
||||
marshaller.marshal(tenantConfiguration, writer);
|
||||
|
||||
@ -119,7 +119,7 @@ public class AndroidDeviceManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantConfiguration getConfiguration() throws DeviceManagementException {
|
||||
public PlatformConfiguration getConfiguration() throws DeviceManagementException {
|
||||
Resource resource;
|
||||
try {
|
||||
String androidRegPath =
|
||||
@ -127,9 +127,9 @@ public class AndroidDeviceManager implements DeviceManager {
|
||||
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
||||
resource = MobileDeviceManagementUtil.getRegistryResource(androidRegPath);
|
||||
if (resource != null) {
|
||||
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
|
||||
JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
|
||||
Unmarshaller unmarshaller = context.createUnmarshaller();
|
||||
return (TenantConfiguration) unmarshaller.unmarshal(
|
||||
return (PlatformConfiguration) unmarshaller.unmarshal(
|
||||
new StringReader(new String((byte[]) resource.getContent(), Charset.
|
||||
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.DeviceManagementException;
|
||||
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.mobile.android.impl.util.AndroidPluginConstants;
|
||||
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 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) {
|
||||
GCMResult result = new GCMResult();
|
||||
@ -163,7 +163,7 @@ public class GCMUtil {
|
||||
getAndroidDeviceManagementService();
|
||||
try {
|
||||
//Get the TenantConfiguration from cache if not we'll get it from DM service
|
||||
TenantConfiguration tenantConfiguration = getTenantConfigurationFromCache();
|
||||
PlatformConfiguration tenantConfiguration = getTenantConfigurationFromCache();
|
||||
if (tenantConfiguration == null) {
|
||||
tenantConfiguration = androidDMService.getDeviceManager().getConfiguration();
|
||||
if (tenantConfiguration != null) {
|
||||
@ -190,11 +190,11 @@ public class GCMUtil {
|
||||
tenantConfigurationCache.remove(getTenantId());
|
||||
}
|
||||
|
||||
private static void addTenantConfigurationToCache(TenantConfiguration tenantConfiguration) {
|
||||
private static void addTenantConfigurationToCache(PlatformConfiguration tenantConfiguration) {
|
||||
tenantConfigurationCache.put(getTenantId(), tenantConfiguration);
|
||||
}
|
||||
|
||||
private static TenantConfiguration getTenantConfigurationFromCache() {
|
||||
private static PlatformConfiguration getTenantConfigurationFromCache() {
|
||||
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.LogFactory;
|
||||
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.LicenseManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
|
||||
@ -79,7 +79,7 @@ public class AndroidDeviceManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveConfiguration(TenantConfiguration tenantConfiguration)
|
||||
public boolean saveConfiguration(PlatformConfiguration tenantConfiguration)
|
||||
throws DeviceManagementException {
|
||||
boolean status;
|
||||
try {
|
||||
@ -90,7 +90,7 @@ public class AndroidDeviceManager implements DeviceManager {
|
||||
DeviceManagementConstants.
|
||||
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
||||
StringWriter writer = new StringWriter();
|
||||
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
|
||||
JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
|
||||
Marshaller marshaller = context.createMarshaller();
|
||||
marshaller.marshal(tenantConfiguration, writer);
|
||||
|
||||
@ -113,7 +113,7 @@ public class AndroidDeviceManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantConfiguration getConfiguration() throws DeviceManagementException {
|
||||
public PlatformConfiguration getConfiguration() throws DeviceManagementException {
|
||||
Resource resource;
|
||||
try {
|
||||
String androidRegPath =
|
||||
@ -121,9 +121,9 @@ public class AndroidDeviceManager implements DeviceManager {
|
||||
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
||||
resource = MobileDeviceManagementUtil.getRegistryResource(androidRegPath);
|
||||
if (resource != null) {
|
||||
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
|
||||
JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
|
||||
Unmarshaller unmarshaller = context.createUnmarshaller();
|
||||
return (TenantConfiguration) unmarshaller.unmarshal(
|
||||
return (PlatformConfiguration) unmarshaller.unmarshal(
|
||||
new StringReader(new String((byte[]) resource.getContent(), Charset.
|
||||
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.DeviceManagementException;
|
||||
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.mobile.impl.android.util.AndroidPluginConstants;
|
||||
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 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) {
|
||||
GCMResult result = new GCMResult();
|
||||
@ -157,7 +157,7 @@ public class GCMUtil {
|
||||
getAndroidDeviceManagementService();
|
||||
try {
|
||||
//Get the TenantConfiguration from cache if not we'll get it from DM service
|
||||
TenantConfiguration tenantConfiguration = getTenantConfigurationFromCache();
|
||||
PlatformConfiguration tenantConfiguration = getTenantConfigurationFromCache();
|
||||
if (tenantConfiguration == null) {
|
||||
tenantConfiguration = androidDMService.getDeviceManager().getConfiguration();
|
||||
if (tenantConfiguration != null) {
|
||||
@ -184,11 +184,11 @@ public class GCMUtil {
|
||||
tenantConfigurationCache.remove(getTenantId());
|
||||
}
|
||||
|
||||
private static void addTenantConfigurationToCache(TenantConfiguration tenantConfiguration) {
|
||||
private static void addTenantConfigurationToCache(PlatformConfiguration tenantConfiguration) {
|
||||
tenantConfigurationCache.put(getTenantId(), tenantConfiguration);
|
||||
}
|
||||
|
||||
private static TenantConfiguration getTenantConfigurationFromCache() {
|
||||
private static PlatformConfiguration getTenantConfigurationFromCache() {
|
||||
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.LogFactory;
|
||||
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.LicenseManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
|
||||
@ -79,7 +79,7 @@ public class WindowsDeviceManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) throws DeviceManagementException {
|
||||
public boolean saveConfiguration(PlatformConfiguration tenantConfiguration) throws DeviceManagementException {
|
||||
boolean status;
|
||||
Resource resource;
|
||||
try {
|
||||
@ -89,7 +89,7 @@ public class WindowsDeviceManager implements DeviceManager {
|
||||
String resourcePath = MobileDeviceManagementUtil.getPlatformConfigPath(
|
||||
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
|
||||
StringWriter writer = new StringWriter();
|
||||
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
|
||||
JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
|
||||
Marshaller marshaller = context.createMarshaller();
|
||||
marshaller.marshal(tenantConfiguration, writer);
|
||||
|
||||
@ -112,16 +112,16 @@ public class WindowsDeviceManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantConfiguration getConfiguration() throws DeviceManagementException {
|
||||
public PlatformConfiguration getConfiguration() throws DeviceManagementException {
|
||||
Resource resource;
|
||||
try {
|
||||
String windowsTenantRegistryPath = MobileDeviceManagementUtil.
|
||||
getPlatformConfigPath(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
|
||||
resource = MobileDeviceManagementUtil.getRegistryResource(windowsTenantRegistryPath);
|
||||
if (resource != null) {
|
||||
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
|
||||
JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
|
||||
Unmarshaller unmarshaller = context.createUnmarshaller();
|
||||
return (TenantConfiguration) unmarshaller.unmarshal(new StringReader(
|
||||
return (PlatformConfiguration) unmarshaller.unmarshal(new StringReader(
|
||||
new String((byte[]) resource.getContent(), Charset.
|
||||
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.DeviceManagementConstants;
|
||||
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.operation.mgt.Operation;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
||||
@ -165,7 +165,7 @@ public class WindowsAPIUtils {
|
||||
getDeviceManagementService().updateOperation(deviceIdentifier, operation);
|
||||
}
|
||||
|
||||
public static TenantConfiguration getTenantConfiguration() throws DeviceManagementException {
|
||||
public static PlatformConfiguration getTenantConfiguration() throws DeviceManagementException {
|
||||
return getDeviceManagementService().getConfiguration(
|
||||
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.ApiResponse;
|
||||
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.util.Message;
|
||||
|
||||
@ -56,7 +56,7 @@ public interface ConfigurationMgtService {
|
||||
@ApiResponse(code = 201, message = "Windows platform configuration saved successfully"),
|
||||
@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.
|
||||
@ -69,13 +69,13 @@ public interface ConfigurationMgtService {
|
||||
httpMethod = "GET",
|
||||
value = "Getting Windows Platform Configurations",
|
||||
notes = "Get the Windows platform configuration details using this REST API",
|
||||
response = TenantConfiguration.class
|
||||
response = PlatformConfiguration.class
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Get Windows Configurations"),
|
||||
@ApiResponse(code = 500, message = "Server Error")
|
||||
})
|
||||
TenantConfiguration getConfiguration() throws WindowsConfigurationException;
|
||||
PlatformConfiguration getConfiguration() throws WindowsConfigurationException;
|
||||
|
||||
/**
|
||||
* 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 " +
|
||||
"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.DeviceManagementException;
|
||||
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.mdm.mobileservices.windows.common.PluginConstants;
|
||||
import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException;
|
||||
@ -54,7 +55,7 @@ public class ConfigurationMgtServiceImpl {
|
||||
* @throws WindowsConfigurationException
|
||||
*/
|
||||
@POST
|
||||
public Message ConfigureSettings(TenantConfiguration configuration) throws WindowsConfigurationException {
|
||||
public Message ConfigureSettings(PlatformConfiguration configuration) throws WindowsConfigurationException {
|
||||
Message responseMsg = new Message();
|
||||
ConfigurationEntry licenseEntry = null;
|
||||
String message;
|
||||
@ -106,15 +107,15 @@ public class ConfigurationMgtServiceImpl {
|
||||
* @throws WindowsConfigurationException
|
||||
*/
|
||||
@GET
|
||||
public TenantConfiguration getConfiguration() throws WindowsConfigurationException {
|
||||
public PlatformConfiguration getConfiguration() throws WindowsConfigurationException {
|
||||
String msg;
|
||||
TenantConfiguration tenantConfiguration = null;
|
||||
PlatformConfiguration PlatformConfiguration = null;
|
||||
try {
|
||||
if (WindowsAPIUtils.getDeviceManagementService().
|
||||
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS) != null) {
|
||||
tenantConfiguration = WindowsAPIUtils.getDeviceManagementService().
|
||||
PlatformConfiguration = WindowsAPIUtils.getDeviceManagementService().
|
||||
getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
|
||||
List<ConfigurationEntry> configs = tenantConfiguration.getConfiguration();
|
||||
List<ConfigurationEntry> configs = PlatformConfiguration.getConfiguration();
|
||||
ConfigurationEntry entry = new ConfigurationEntry();
|
||||
License license = WindowsAPIUtils.getDeviceManagementService().getLicense(
|
||||
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, PluginConstants.
|
||||
@ -124,7 +125,7 @@ public class ConfigurationMgtServiceImpl {
|
||||
entry.setName(PluginConstants.TenantConfigProperties.LICENSE_KEY);
|
||||
entry.setValue(license.getText());
|
||||
configs.add(entry);
|
||||
tenantConfiguration.setConfiguration(configs);
|
||||
PlatformConfiguration.setConfiguration(configs);
|
||||
}
|
||||
}
|
||||
} catch (DeviceManagementException e) {
|
||||
@ -132,7 +133,7 @@ public class ConfigurationMgtServiceImpl {
|
||||
log.error(msg, e);
|
||||
throw new WindowsConfigurationException(msg, e);
|
||||
}
|
||||
return tenantConfiguration;
|
||||
return PlatformConfiguration;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,7 +144,7 @@ public class ConfigurationMgtServiceImpl {
|
||||
* @throws WindowsConfigurationException
|
||||
*/
|
||||
@PUT
|
||||
public Message updateConfiguration(TenantConfiguration configuration) throws WindowsConfigurationException {
|
||||
public Message updateConfiguration(PlatformConfiguration configuration) throws WindowsConfigurationException {
|
||||
String message;
|
||||
Message responseMsg = new Message();
|
||||
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.device.mgt.common.DeviceManagementException;
|
||||
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.beans.CacheEntry;
|
||||
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 {
|
||||
if (WindowsAPIUtils.getTenantConfiguration() != null) {
|
||||
TenantConfiguration configuration = WindowsAPIUtils.getTenantConfiguration();
|
||||
PlatformConfiguration configuration = WindowsAPIUtils.getTenantConfiguration();
|
||||
return configuration.getConfiguration();
|
||||
} else {
|
||||
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.LogFactory;
|
||||
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.LicenseManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
|
||||
@ -79,7 +79,7 @@ public class WindowsDeviceManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveConfiguration(TenantConfiguration tenantConfiguration)
|
||||
public boolean saveConfiguration(PlatformConfiguration tenantConfiguration)
|
||||
throws DeviceManagementException {
|
||||
boolean status;
|
||||
Resource resource;
|
||||
@ -91,7 +91,7 @@ public class WindowsDeviceManager implements DeviceManager {
|
||||
DeviceManagementConstants.
|
||||
MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
|
||||
StringWriter writer = new StringWriter();
|
||||
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
|
||||
JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
|
||||
Marshaller marshaller = context.createMarshaller();
|
||||
marshaller.marshal(tenantConfiguration, writer);
|
||||
|
||||
@ -114,7 +114,7 @@ public class WindowsDeviceManager implements DeviceManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantConfiguration getConfiguration() throws DeviceManagementException {
|
||||
public PlatformConfiguration getConfiguration() throws DeviceManagementException {
|
||||
Resource resource;
|
||||
try {
|
||||
String windowsTenantRegistryPath =
|
||||
@ -122,9 +122,9 @@ public class WindowsDeviceManager implements DeviceManager {
|
||||
MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
|
||||
resource = MobileDeviceManagementUtil.getRegistryResource(windowsTenantRegistryPath);
|
||||
if (resource != null) {
|
||||
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
|
||||
JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
|
||||
Unmarshaller unmarshaller = context.createUnmarshaller();
|
||||
return (TenantConfiguration) unmarshaller.unmarshal(
|
||||
return (PlatformConfiguration) unmarshaller.unmarshal(
|
||||
new StringReader(new String((byte[]) resource.getContent(), Charset.
|
||||
forName(MobilePluginConstants.CHARSET_UTF8))));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user