Incorporating API changes introduced into the device management core

revert-dabc3590
prabathabey 10 years ago
parent 7f436f4f75
commit fd7ab1aa54

@ -19,6 +19,9 @@
package org.wso2.carbon.device.mgt.mobile;
import org.wso2.carbon.device.mgt.common.*;
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 java.util.List;

@ -20,12 +20,12 @@ 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.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import org.wso2.carbon.device.mgt.common.*;
import java.util.ArrayList;
import java.util.List;
@ -33,20 +33,20 @@ import java.util.List;
/**
* This represents the Android implementation of DeviceManagerService.
*/
public class AndroidDeviceManagerService implements DeviceManagerService {
public class AndroidDeviceManagerService implements DeviceManager {
private static final Log log = LogFactory.getLog(AndroidDeviceManagerService.class);
private OperationManager operationManager;
public AndroidDeviceManagerService() {
this.operationManager = new AndroidMobileOperationManager();
}
@Override
public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID;
}
@Override
public FeatureManager getFeatureManager() {
return null;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
boolean status;
@ -180,9 +180,4 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
return devices;
}
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return operationManager;
}
}

@ -21,6 +21,8 @@ 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.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.mobile.AbstractMobileOperationManager;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
@ -38,8 +40,8 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
private static final Log log = LogFactory.getLog(AndroidMobileOperationManager.class);
@Override
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices) throws
OperationManagementException {
public boolean addOperation(Operation operation,
List<DeviceIdentifier> devices) throws OperationManagementException {
boolean status = false;
try {
MobileDeviceOperationMapping mobileDeviceOperationMapping = null;
@ -65,8 +67,7 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
}
}
} catch (MobileDeviceManagementDAOException e) {
String msg =
"Error while adding an operation " + operation.getCode() + "to Android devices";
String msg = "Error while adding an operation " + operation.getCode() + "to Android devices";
log.error(msg, e);
throw new OperationManagementException(msg, e);
}
@ -90,16 +91,14 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
.getMobileOperationIdsFromMobileDeviceOperations(
mobileDeviceOperationMappings);
for (Integer operationId : operationIds) {
mobileOperation = MobileDeviceManagementDAOFactory.getMobileOperationDAO()
.getMobileOperation(
mobileOperation = MobileDeviceManagementDAOFactory.getMobileOperationDAO().getMobileOperation(
operationId);
operationProperties =
MobileDeviceManagementDAOFactory.getMobileOperationPropertyDAO()
.getAllMobileOperationPropertiesOfOperation(
operationId);
mobileOperation.setProperties(operationProperties);
operations.add(MobileDeviceManagementUtil
.convertMobileOperationToOperation(mobileOperation));
operations.add(MobileDeviceManagementUtil.convertMobileOperationToOperation(mobileOperation));
}
}
} catch (MobileDeviceManagementDAOException e) {
@ -158,7 +157,7 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
}
@Override
public List<Feature> getFeaturesForDeviceType(String deviceType) throws FeatureManagementException {
public List<Feature> getFeatures(String deviceType) throws FeatureManagementException {
MobileFeatureDAO featureDAO = MobileDeviceManagementDAOFactory.getFeatureDAO();
MobileFeaturePropertyDAO featurePropertyDAO = MobileDeviceManagementDAOFactory.getFeaturePropertyDAO();
List<Feature> features = new ArrayList<Feature>();
@ -183,12 +182,11 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
features.add(feature);
}
} catch (MobileDeviceManagementDAOException e) {
String msg =
"Error while fetching the features for the device type " +
deviceType;
String msg = "Error while fetching the features for the device type " + deviceType;
log.error(msg, e);
throw new FeatureManagementException(msg, e);
}
return features;
}
}

@ -19,20 +19,25 @@
package org.wso2.carbon.device.mgt.mobile.impl.ios;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import java.util.List;
/**
* This represents the iOS implementation of DeviceManagerService.
*/
public class IOSDeviceManagerService implements DeviceManagerService {
public class IOSDeviceManagerService implements DeviceManager {
@Override
public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS;
}
@Override
public FeatureManager getFeatureManager() {
return null;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
return true;
@ -80,11 +85,6 @@ public class IOSDeviceManagerService implements DeviceManagerService {
return true;
}
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return null;
}
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
return true;

@ -19,20 +19,25 @@
package org.wso2.carbon.device.mgt.mobile.impl.windows;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import java.util.List;
/**
* This represents the Windows implementation of DeviceManagerService.
*/
public class WindowsDeviceManagerService implements DeviceManagerService {
public class WindowsDeviceManagerService implements DeviceManager {
@Override
public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS;
}
@Override
public FeatureManager getFeatureManager() {
return null;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
return true;
@ -79,11 +84,6 @@ public class WindowsDeviceManagerService implements DeviceManagerService {
return true;
}
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return null;
}
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
return true;

@ -25,17 +25,17 @@ import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIProvider;
import org.wso2.carbon.apimgt.impl.APIManagerFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.mobile.DataSourceListener;
import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.config.APIConfig;
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager;
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
import java.util.ArrayList;
import java.util.List;
@ -69,13 +69,13 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B
MobileDeviceManagementDAOFactory.setMobileDataSourceConfig(dsConfig);
androidServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(),
bundleContext.registerService(DeviceManager.class.getName(),
new AndroidDeviceManagerService(), null);
iOSServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(),
bundleContext.registerService(DeviceManager.class.getName(),
new IOSDeviceManagerService(), null);
windowsServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(),
bundleContext.registerService(DeviceManager.class.getName(),
new WindowsDeviceManagerService(), null);
/* Initialize all API configurations with corresponding API Providers */

@ -23,14 +23,10 @@ import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIProvider;
import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
import org.wso2.carbon.apimgt.impl.APIManagerFactory;
import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil;
import org.wso2.carbon.core.ServerStartupObserver;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.mobile.MobileDeviceManagementStartupObserver;
import org.wso2.carbon.device.mgt.mobile.config.APIConfig;
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager;
@ -100,13 +96,13 @@ public class MobileDeviceManagementServiceComponent {
}
androidServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(),
bundleContext.registerService(DeviceManager.class.getName(),
new AndroidDeviceManagerService(), null);
iOSServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(),
bundleContext.registerService(DeviceManager.class.getName(),
new IOSDeviceManagerService(), null);
windowsServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(),
bundleContext.registerService(DeviceManager.class.getName(),
new WindowsDeviceManagerService(), null);
serverStartupObserverRef = bundleContext.registerService(ServerStartupObserver.class,

@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDeviceOperationMapping;
import org.wso2.carbon.device.mgt.mobile.dto.MobileOperation;
@ -117,7 +117,7 @@ public class MobileDeviceManagementUtil {
return device;
}
public static MobileOperation convertToMobileOperation(org.wso2.carbon.device.mgt.common.Operation operation) {
public static MobileOperation convertToMobileOperation(Operation operation) {
MobileOperation mobileOperation = new MobileOperation();
MobileOperationProperty operationProperty = null;
List<MobileOperationProperty> properties = new LinkedList<MobileOperationProperty>();

@ -17,7 +17,8 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>

@ -201,22 +201,22 @@
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
<version>${cdm.core.version}</version>
<version>${carbon.device.mgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
<version>${cdm.core.version}</version>
<version>${carbon.device.mgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
<version>${cdm.core.version}</version>
<version>${carbon.device.mgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
<version>${cdm.core.version}</version>
<version>${carbon.device.mgt.version}</version>
</dependency>
<!--MDM dependencies-->
@ -422,10 +422,6 @@
<carbon.kernel.version>4.3.0</carbon.kernel.version>
<carbon.kernel.version.range>[4.3.0, 4.4.0)</carbon.kernel.version.range>
<!--CDM versions-->
<cdm.core.version>0.9.0</cdm.core.version>
<cdm.core.version.range>[0.8.0, 2.0.0)</cdm.core.version.range>
<carbon.p2.plugin.version>1.5.4</carbon.p2.plugin.version>
<!--Maven build number plugin-->
@ -445,7 +441,6 @@
<orbit.tomcat.version>7.0.52.wso2v5</orbit.tomcat.version>
<orbit.tomcat.jdbc.pooling.version>7.0.34.wso2v2</orbit.tomcat.jdbc.pooling.version>
<!--CXF properties-->
<cxf.version>2.6.1</cxf.version>
<jackson.version>1.9.0</jackson.version>
@ -470,7 +465,8 @@
<carbon.governance.version>4.3.0</carbon.governance.version>
<!-- Device Management -->
<carbon.device.mgt.version>0.9.0</carbon.device.mgt.version>
<carbon.device.mgt.version>0.9.2-SNAPSHOT</carbon.device.mgt.version>
<carbon.device.mgt.version.range>0.9.2-SNAPSHOT</carbon.device.mgt.version.range>
<!-- Mobile Device Management -->
<carbon.mobile.device.mgt.version>1.9.1-SNAPSHOT</carbon.mobile.device.mgt.version>

Loading…
Cancel
Save