Renaming TenantConfiguration as PlatformConfiguration

merge-requests/7/head
prabathabey 9 years ago
parent 4462c353b4
commit ebefd60533

@ -20,7 +20,7 @@ package org.wso2.carbon.device.mgt.jaxrs.api;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.*;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@ -55,7 +55,7 @@ public interface Configuration {
@Permission(scope = "configuration-modify", permissions = {"/permission/admin/device-mgt/admin/platform-configs/modify"})
Response saveTenantConfiguration(@ApiParam(name = "configuration", value = "The required properties to "
+ "update the platform configurations the as the <JSON_PAYLOAD> value",
required = true) TenantConfiguration configuration);
required = true) PlatformConfiguration configuration);
@GET
@ApiOperation(
@ -64,7 +64,7 @@ public interface Configuration {
httpMethod = "GET",
value = "Getting General Platform Configurations",
notes = "Get the general platform level configuration details using this REST API",
response = TenantConfiguration.class)
response = PlatformConfiguration.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 500, message = "Error occurred while retrieving the tenant configuration")
@ -86,6 +86,6 @@ public interface Configuration {
@Permission(scope = "configuration-modify", permissions = {"/permission/admin/device-mgt/admin/platform-configs/modify"})
Response updateConfiguration(@ApiParam(name = "configuration", value = "The required properties to update"
+ " the platform configurations the as the <JSON_PAYLOAD> value",
required = true) TenantConfiguration configuration);
required = true) PlatformConfiguration configuration);
}

@ -23,7 +23,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException;
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.jaxrs.api.Configuration;
import org.wso2.carbon.device.mgt.jaxrs.api.util.DeviceMgtAPIUtils;
import org.wso2.carbon.device.mgt.jaxrs.api.util.MDMAppConstants;
@ -51,7 +51,7 @@ public class ConfigurationImpl implements Configuration{
private static Log log = LogFactory.getLog(ConfigurationImpl.class);
@POST
public Response saveTenantConfiguration(TenantConfiguration configuration) {
public Response saveTenantConfiguration(PlatformConfiguration configuration) {
ResponsePayload responseMsg = new ResponsePayload();
try {
DeviceMgtAPIUtils.getTenantConfigurationManagementService().saveConfiguration(configuration,
@ -72,7 +72,7 @@ public class ConfigurationImpl implements Configuration{
public Response getConfiguration() {
String msg;
try {
TenantConfiguration tenantConfiguration = DeviceMgtAPIUtils.getTenantConfigurationManagementService().
PlatformConfiguration tenantConfiguration = DeviceMgtAPIUtils.getTenantConfigurationManagementService().
getConfiguration(MDMAppConstants.RegistryConstants.GENERAL_CONFIG_RESOURCE_PATH);
ConfigurationEntry configurationEntry = new ConfigurationEntry();
configurationEntry.setContentType("text");
@ -93,7 +93,7 @@ public class ConfigurationImpl implements Configuration{
}
@PUT
public Response updateConfiguration(TenantConfiguration configuration) {
public Response updateConfiguration(PlatformConfiguration configuration) {
ResponsePayload responseMsg = new ResponsePayload();
try {
DeviceMgtAPIUtils.getTenantConfigurationManagementService().saveConfiguration(configuration,

@ -24,12 +24,12 @@ import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataService;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService;
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.PaginationResult;
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.TenantConfigurationManagementService;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService;
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager;
@ -57,7 +57,7 @@ public class DeviceMgtAPIUtils {
private static final String NOTIFIER_FREQUENCY = "notifierFrequency";
private static Log log = LogFactory.getLog(DeviceMgtAPIUtils.class);
public static int getNotifierFrequency(TenantConfiguration tenantConfiguration) {
public static int getNotifierFrequency(PlatformConfiguration tenantConfiguration) {
List<ConfigurationEntry> configEntryList = tenantConfiguration.getConfiguration();
if (configEntryList != null && !configEntryList.isEmpty()) {
for(ConfigurationEntry entry : configEntryList) {
@ -234,10 +234,10 @@ public class DeviceMgtAPIUtils {
return policyManagementService;
}
public static TenantConfigurationManagementService getTenantConfigurationManagementService() {
public static PlatformConfigurationManagementService getTenantConfigurationManagementService() {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
TenantConfigurationManagementService tenantConfigurationManagementService =
(TenantConfigurationManagementService) ctx.getOSGiService(TenantConfigurationManagementService.class, null);
PlatformConfigurationManagementService tenantConfigurationManagementService =
(PlatformConfigurationManagementService) ctx.getOSGiService(PlatformConfigurationManagementService.class, null);
if (tenantConfigurationManagementService == null) {
String msg = "Tenant configuration Management service not initialized.";
log.error(msg);

@ -17,7 +17,7 @@
*/
package 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;
@ -40,14 +40,14 @@ public interface DeviceManager {
*
* @return Returns the status of the operation
*/
boolean saveConfiguration(TenantConfiguration configuration) throws DeviceManagementException;
boolean saveConfiguration(PlatformConfiguration configuration) throws DeviceManagementException;
/**
* Method to get platform specific Configuration.
*
* @return Returns the platform specific tenant configurations
*/
TenantConfiguration getConfiguration() throws DeviceManagementException;
PlatformConfiguration getConfiguration() throws DeviceManagementException;
/**
* Method to enrolling a particular device of type mobile, IoT, etc within CDM.

@ -31,12 +31,12 @@ import java.util.List;
/**
* Represents the tenant configuration for a device platform.
*/
@XmlRootElement(name = "tenantConfiguration")
@XmlRootElement(name = "PlatformConfiguration")
@XmlAccessorType(XmlAccessType.NONE)
@ApiModel(value = "TenantConfiguration",
@ApiModel(value = "PlatformConfiguration",
description = "This class carries all information related to a Tenant configuration")
public class TenantConfiguration implements Serializable {
public class PlatformConfiguration implements Serializable {
@XmlElement(name = "type")
@ApiModelProperty(name = "type", value = "type of device", required = true)

@ -21,7 +21,7 @@ package org.wso2.carbon.device.mgt.common.configuration.mgt;
* This represents the tenant configuration management functionality which should be implemented by
* the device type plugins.
*/
public interface TenantConfigurationManagementService {
public interface PlatformConfigurationManagementService {
/**
* Method to add a operation to a device or a set of devices.
@ -31,7 +31,7 @@ public interface TenantConfigurationManagementService {
* @throws org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException If some unusual behaviour is observed while adding the
* configuration.
*/
boolean saveConfiguration(TenantConfiguration tenantConfiguration, String resourcePath) throws
boolean saveConfiguration(PlatformConfiguration tenantConfiguration, String resourcePath) throws
ConfigurationManagementException;
/**
@ -41,6 +41,6 @@ public interface TenantConfigurationManagementService {
* @throws org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException If some unusual behaviour is observed while fetching the
* operation list.
*/
TenantConfiguration getConfiguration(String resourcePath) throws ConfigurationManagementException;
PlatformConfiguration getConfiguration(String resourcePath) throws ConfigurationManagementException;
}

@ -20,8 +20,8 @@ package org.wso2.carbon.device.mgt.core.config.tenant;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfigurationManagementService;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService;
import org.wso2.carbon.device.mgt.core.config.ConfigurationManagerConstants;
import org.wso2.carbon.device.mgt.core.config.util.ConfigurationManagerUtil;
import org.wso2.carbon.registry.api.Resource;
@ -36,17 +36,17 @@ import java.io.StringWriter;
import java.nio.charset.Charset;
/**
* This class implements all the functionality exposed as part of the TenantConfigurationManagementService.
* This class implements all the functionality exposed as part of the PlatformConfigurationManagementService.
* Main usage of this module is saving/retrieving tenant configurations to the registry.
*
*/
public class TenantConfigurationManagementServiceImpl
implements TenantConfigurationManagementService {
implements PlatformConfigurationManagementService {
private static final Log log = LogFactory.getLog(TenantConfigurationManagementServiceImpl.class);
@Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration, String resourcePath)
public boolean saveConfiguration(PlatformConfiguration tenantConfiguration, String resourcePath)
throws ConfigurationManagementException {
boolean status;
try {
@ -54,7 +54,7 @@ public class TenantConfigurationManagementServiceImpl
log.debug("Persisting tenant configurations in Registry");
}
StringWriter writer = new StringWriter();
JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class);
JAXBContext context = JAXBContext.newInstance(PlatformConfiguration.class);
Marshaller marshaller = context.createMarshaller();
marshaller.marshal(tenantConfiguration, writer);
@ -74,19 +74,19 @@ public class TenantConfigurationManagementServiceImpl
}
@Override
public TenantConfiguration getConfiguration(String resourcePath)
public PlatformConfiguration getConfiguration(String resourcePath)
throws ConfigurationManagementException {
Resource resource;
try {
resource = ConfigurationManagerUtil.getRegistryResource(resourcePath);
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(ConfigurationManagerConstants.CharSets.CHARSET_UTF8))));
}
return new TenantConfiguration();
return new PlatformConfiguration();
} catch (JAXBException e) {
throw new ConfigurationManagementException(
"Error occurred while parsing the Tenant configuration : " + e.getMessage(), e);

@ -25,13 +25,11 @@ import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfigurationManagementService;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.common.permission.mgt.PermissionManagerService;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationProvider;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository;
@ -51,7 +49,6 @@ import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManageme
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManagerImpl;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.permission.mgt.PermissionManagerServiceImpl;
import org.wso2.carbon.device.mgt.core.push.notification.mgt.PushNotificationConfigRepository;
import org.wso2.carbon.device.mgt.core.push.notification.mgt.PushNotificationProviderRepository;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl;
@ -221,9 +218,9 @@ public class DeviceManagementServiceComponent {
bundleContext.registerService(GroupManagementProviderService.class.getName(), groupManagementProvider, null);
/* Registering Tenant Configuration Management Service */
TenantConfigurationManagementService
PlatformConfigurationManagementService
tenantConfiguration = new TenantConfigurationManagementServiceImpl();
bundleContext.registerService(TenantConfigurationManagementService.class.getName(), tenantConfiguration, null);
bundleContext.registerService(PlatformConfigurationManagementService.class.getName(), tenantConfiguration, null);
/* Registering Notification Service */
NotificationManagementService notificationManagementService

@ -24,12 +24,11 @@ import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult;
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.operation.mgt.Activity;
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.OperationManager;
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import java.util.List;
@ -78,7 +77,7 @@ public interface DeviceManagementProviderService {
* @throws DeviceManagementException If some unusual behaviour is observed while fetching the
* configuration.
*/
TenantConfiguration getConfiguration(String deviceType) throws DeviceManagementException;
PlatformConfiguration getConfiguration(String deviceType) throws DeviceManagementException;
/**
* Method to get the list of devices owned by an user with paging information.
@ -187,9 +186,9 @@ public interface DeviceManagementProviderService {
boolean enrollDevice(Device device) throws DeviceManagementException;
TenantConfiguration getConfiguration() throws DeviceManagementException;
PlatformConfiguration getConfiguration() throws DeviceManagementException;
boolean saveConfiguration(TenantConfiguration configuration) throws DeviceManagementException;
boolean saveConfiguration(PlatformConfiguration configuration) throws DeviceManagementException;
boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException;

@ -30,7 +30,7 @@ import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.common.TransactionManagementException;
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.operation.mgt.Activity;
@ -93,7 +93,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
@Override
public boolean saveConfiguration(TenantConfiguration configuration) throws DeviceManagementException {
public boolean saveConfiguration(PlatformConfiguration configuration) throws DeviceManagementException {
DeviceManager dms =
pluginRepository.getDeviceManagementService(configuration.getType(),
this.getTenantId()).getDeviceManager();
@ -101,12 +101,12 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
@Override
public TenantConfiguration getConfiguration() throws DeviceManagementException {
public PlatformConfiguration getConfiguration() throws DeviceManagementException {
return null;
}
@Override
public TenantConfiguration getConfiguration(String deviceType) throws DeviceManagementException {
public PlatformConfiguration getConfiguration(String deviceType) throws DeviceManagementException {
DeviceManager dms =
pluginRepository.getDeviceManagementService(deviceType, this.getTenantId()).getDeviceManager();
if (dms == null) {

@ -16,7 +16,7 @@
package org.wso2.carbon.device.mgt.core;
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;
@ -34,12 +34,12 @@ public class TestDeviceManager implements DeviceManager {
}
@Override
public boolean saveConfiguration(TenantConfiguration configuration)
public boolean saveConfiguration(PlatformConfiguration configuration)
throws DeviceManagementException {
return false;
}
@Override public TenantConfiguration getConfiguration() throws DeviceManagementException {
@Override public PlatformConfiguration getConfiguration() throws DeviceManagementException {
return null;
}

@ -24,8 +24,8 @@ import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfigurationManagementService;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
@ -198,8 +198,8 @@ public class PolicyManagerUtil {
public static int getMonitoringFequency() {
TenantConfigurationManagementService configMgtService = new TenantConfigurationManagementServiceImpl();
TenantConfiguration tenantConfiguration = null;
PlatformConfigurationManagementService configMgtService = new TenantConfigurationManagementServiceImpl();
PlatformConfiguration tenantConfiguration = null;
int monitoringFrequency = 0;
try {
tenantConfiguration = configMgtService.getConfiguration(GENERAL_CONFIG_RESOURCE_PATH);

Loading…
Cancel
Save