Added tenant configuration persistance

revert-70aa11f8
harshanl 9 years ago
parent 8047cd9d0a
commit 50640c9dfd

@ -17,6 +17,8 @@
*/
package org.wso2.carbon.device.mgt.common;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import java.util.List;
/**
@ -31,6 +33,20 @@ public interface DeviceManager {
*/
FeatureManager getFeatureManager();
/**
* Method to save platform specific Configuration.
*
* @return Returns the status of the operation
*/
boolean saveConfiguration(TenantConfiguration configuration) throws DeviceManagementException;
/**
* Method to get platform specific Configuration.
*
* @return Returns the platform specific tenant configurations
*/
TenantConfiguration getConfiguration() throws DeviceManagementException;
/**
* Method to enrolling a particular device of type mobile, IoT, etc within CDM.
*

@ -0,0 +1,53 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common.configuration.mgt;
/**
* Represents an individual configuration entry.
*/
public class ConfigurationEntry {
private String name;
private String contentType;
private Object value;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
}

@ -0,0 +1,47 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common.configuration.mgt;
import java.util.List;
/**
* Represents an individual configuration entry.
*/
public class TenantConfiguration {
private String type;
private List<ConfigurationEntry> configuration;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<ConfigurationEntry> getConfiguration() {
return configuration;
}
public void setConfiguration(List<ConfigurationEntry> configuration) {
this.configuration = configuration;
}
}

@ -24,7 +24,7 @@ import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
/**
* Composite interface that acts as the SPI exposing all device management as well as application management
* functionalities
* functionalities.
*/
public interface DeviceManagementService extends ApplicationManager {

@ -97,6 +97,7 @@ public class EmailServiceProviderImpl implements EmailService {
if (configContext != null) {
serviceClient = new ServiceClient(configContext, null);
} else {
serviceClient = new ServiceClient();
}
Options options = new Options();

@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.core.service;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import java.util.List;
@ -40,6 +41,16 @@ public interface DeviceManagementProviderService extends DeviceManager, LicenseM
FeatureManager getFeatureManager(String type) throws DeviceManagementException;
/**
* Proxy method to get the tenant configuration of a given platform.
*
* @param type Device platform
* @return Tenant configuration settings of the particular tenant and platform.
* @throws DeviceManagementException If some unusual behaviour is observed while fetching the
* configuration.
*/
TenantConfiguration getConfiguration(String type) throws DeviceManagementException;
/**
* Method to get the list of devices owned by an user.
*

@ -21,6 +21,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
@ -89,6 +90,26 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
return null;
}
@Override
public boolean saveConfiguration(TenantConfiguration configuration)
throws DeviceManagementException {
DeviceManager dms =
this.getPluginRepository().getDeviceManagementService(configuration.getType()).getDeviceManager();
return dms.saveConfiguration(configuration);
}
@Override
public TenantConfiguration getConfiguration() throws DeviceManagementException {
return null;
}
@Override
public TenantConfiguration getConfiguration(String type) throws DeviceManagementException {
DeviceManager dms =
this.getPluginRepository().getDeviceManagementService(type).getDeviceManager();
return dms.getConfiguration();
}
@Override
public FeatureManager getFeatureManager(String type) {
DeviceManager dms =

@ -16,8 +16,11 @@
package org.wso2.carbon.device.mgt.core;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import java.util.List;
import java.util.Map;
public class TestDeviceManager implements DeviceManager {
@ -26,6 +29,16 @@ public class TestDeviceManager implements DeviceManager {
return null;
}
@Override
public boolean saveConfiguration(TenantConfiguration configuration)
throws DeviceManagementException {
return false;
}
@Override public TenantConfiguration getConfiguration() throws DeviceManagementException {
return null;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
return true;

Loading…
Cancel
Save