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; package org.wso2.carbon.device.mgt.mobile;
import org.wso2.carbon.device.mgt.common.*; 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; 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.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.spi.DeviceManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException; 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.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice; import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil; import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import org.wso2.carbon.device.mgt.common.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,20 +33,20 @@ import java.util.List;
/** /**
* This represents the Android implementation of DeviceManagerService. * 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 static final Log log = LogFactory.getLog(AndroidDeviceManagerService.class);
private OperationManager operationManager;
public AndroidDeviceManagerService() {
this.operationManager = new AndroidMobileOperationManager();
}
@Override @Override
public String getProviderType() { public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID; return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID;
} }
@Override
public FeatureManager getFeatureManager() {
return null;
}
@Override @Override
public boolean enrollDevice(Device device) throws DeviceManagementException { public boolean enrollDevice(Device device) throws DeviceManagementException {
boolean status; boolean status;
@ -180,9 +180,4 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
return devices; 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.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.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.AbstractMobileOperationManager;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException; 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.dao.MobileDeviceManagementDAOFactory;
@ -38,8 +40,8 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
private static final Log log = LogFactory.getLog(AndroidMobileOperationManager.class); private static final Log log = LogFactory.getLog(AndroidMobileOperationManager.class);
@Override @Override
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices) throws public boolean addOperation(Operation operation,
OperationManagementException { List<DeviceIdentifier> devices) throws OperationManagementException {
boolean status = false; boolean status = false;
try { try {
MobileDeviceOperationMapping mobileDeviceOperationMapping = null; MobileDeviceOperationMapping mobileDeviceOperationMapping = null;
@ -65,8 +67,7 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
} }
} }
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
String msg = String msg = "Error while adding an operation " + operation.getCode() + "to Android devices";
"Error while adding an operation " + operation.getCode() + "to Android devices";
log.error(msg, e); log.error(msg, e);
throw new OperationManagementException(msg, e); throw new OperationManagementException(msg, e);
} }
@ -90,16 +91,14 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
.getMobileOperationIdsFromMobileDeviceOperations( .getMobileOperationIdsFromMobileDeviceOperations(
mobileDeviceOperationMappings); mobileDeviceOperationMappings);
for (Integer operationId : operationIds) { for (Integer operationId : operationIds) {
mobileOperation = MobileDeviceManagementDAOFactory.getMobileOperationDAO() mobileOperation = MobileDeviceManagementDAOFactory.getMobileOperationDAO().getMobileOperation(
.getMobileOperation(
operationId); operationId);
operationProperties = operationProperties =
MobileDeviceManagementDAOFactory.getMobileOperationPropertyDAO() MobileDeviceManagementDAOFactory.getMobileOperationPropertyDAO()
.getAllMobileOperationPropertiesOfOperation( .getAllMobileOperationPropertiesOfOperation(
operationId); operationId);
mobileOperation.setProperties(operationProperties); mobileOperation.setProperties(operationProperties);
operations.add(MobileDeviceManagementUtil operations.add(MobileDeviceManagementUtil.convertMobileOperationToOperation(mobileOperation));
.convertMobileOperationToOperation(mobileOperation));
} }
} }
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
@ -158,7 +157,7 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
} }
@Override @Override
public List<Feature> getFeaturesForDeviceType(String deviceType) throws FeatureManagementException { public List<Feature> getFeatures(String deviceType) throws FeatureManagementException {
MobileFeatureDAO featureDAO = MobileDeviceManagementDAOFactory.getFeatureDAO(); MobileFeatureDAO featureDAO = MobileDeviceManagementDAOFactory.getFeatureDAO();
MobileFeaturePropertyDAO featurePropertyDAO = MobileDeviceManagementDAOFactory.getFeaturePropertyDAO(); MobileFeaturePropertyDAO featurePropertyDAO = MobileDeviceManagementDAOFactory.getFeaturePropertyDAO();
List<Feature> features = new ArrayList<Feature>(); List<Feature> features = new ArrayList<Feature>();
@ -183,12 +182,11 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
features.add(feature); features.add(feature);
} }
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
String msg = String msg = "Error while fetching the features for the device type " + deviceType;
"Error while fetching the features for the device type " +
deviceType;
log.error(msg, e); log.error(msg, e);
throw new FeatureManagementException(msg, e); throw new FeatureManagementException(msg, e);
} }
return features; return features;
} }
} }

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

@ -19,20 +19,25 @@
package org.wso2.carbon.device.mgt.mobile.impl.windows; package org.wso2.carbon.device.mgt.mobile.impl.windows;
import org.wso2.carbon.device.mgt.common.*; 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; import java.util.List;
/** /**
* This represents the Windows implementation of DeviceManagerService. * This represents the Windows implementation of DeviceManagerService.
*/ */
public class WindowsDeviceManagerService implements DeviceManagerService { public class WindowsDeviceManagerService implements DeviceManager {
@Override @Override
public String getProviderType() { public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS; return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS;
} }
@Override
public FeatureManager getFeatureManager() {
return null;
}
@Override @Override
public boolean enrollDevice(Device device) throws DeviceManagementException { public boolean enrollDevice(Device device) throws DeviceManagementException {
return true; return true;
@ -79,11 +84,6 @@ public class WindowsDeviceManagerService implements DeviceManagerService {
return true; return true;
} }
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return null;
}
@Override @Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException { public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
return true; 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.api.APIProvider;
import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.APIManagerFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; 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.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.APIConfig;
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager; 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.MobileDeviceManagementConfig;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; 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.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.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.impl.windows.WindowsDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -69,13 +69,13 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B
MobileDeviceManagementDAOFactory.setMobileDataSourceConfig(dsConfig); MobileDeviceManagementDAOFactory.setMobileDataSourceConfig(dsConfig);
androidServiceRegRef = androidServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(), bundleContext.registerService(DeviceManager.class.getName(),
new AndroidDeviceManagerService(), null); new AndroidDeviceManagerService(), null);
iOSServiceRegRef = iOSServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(), bundleContext.registerService(DeviceManager.class.getName(),
new IOSDeviceManagerService(), null); new IOSDeviceManagerService(), null);
windowsServiceRegRef = windowsServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(), bundleContext.registerService(DeviceManager.class.getName(),
new WindowsDeviceManagerService(), null); new WindowsDeviceManagerService(), null);
/* Initialize all API configurations with corresponding API Providers */ /* 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.BundleContext;
import org.osgi.framework.ServiceRegistration; import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext; 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.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.core.ServerStartupObserver;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; 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.MobileDeviceManagementStartupObserver;
import org.wso2.carbon.device.mgt.mobile.config.APIConfig; 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.MobileDeviceConfigurationManager;
@ -100,13 +96,13 @@ public class MobileDeviceManagementServiceComponent {
} }
androidServiceRegRef = androidServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(), bundleContext.registerService(DeviceManager.class.getName(),
new AndroidDeviceManagerService(), null); new AndroidDeviceManagerService(), null);
iOSServiceRegRef = iOSServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(), bundleContext.registerService(DeviceManager.class.getName(),
new IOSDeviceManagerService(), null); new IOSDeviceManagerService(), null);
windowsServiceRegRef = windowsServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(), bundleContext.registerService(DeviceManager.class.getName(),
new WindowsDeviceManagerService(), null); new WindowsDeviceManagerService(), null);
serverStartupObserverRef = bundleContext.registerService(ServerStartupObserver.class, serverStartupObserverRef = bundleContext.registerService(ServerStartupObserver.class,

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

@ -17,7 +17,8 @@
~ under the License. ~ 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> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>

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

Loading…
Cancel
Save