From 18d3b0d20d4c07c0e54d563bbc706b7b02513ad2 Mon Sep 17 00:00:00 2001 From: manoj Date: Mon, 11 May 2015 12:36:19 +0530 Subject: [PATCH] APP Manager integration and move IOS related functionality to IOS plugin --- .../org.wso2.carbon.device.mgt.mobile.impl/pom.xml | 1 + .../mobile/dao/MobileDeviceManagementDAOFactory.java | 2 -- .../mgt/mobile/impl/android/AndroidDeviceManager.java | 10 +++++++++- .../impl/android/dao/impl/AndroidFeatureDAOImpl.java | 6 ++---- .../mgt/mobile/impl/windows/WindowsDeviceManager.java | 10 +++++++++- .../MobileDeviceManagementBundleActivator.java | 6 ------ .../MobileDeviceManagementServiceComponent.java | 11 +---------- 7 files changed, 22 insertions(+), 24 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml index 9724e4eaf4..c66a4f9e17 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml @@ -70,6 +70,7 @@ !org.wso2.carbon.device.mgt.mobile.internal, + !org.wso2.carbon.device.mgt.mobile.impl, org.wso2.carbon.device.mgt.mobile.*, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java index 331e96941f..1e8d607423 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java @@ -25,8 +25,6 @@ import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.config.datasource.JNDILookupDefinition; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil; -import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.FeatureManagementDAOException; - import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java index fa5d56f7bd..925d6b1e1e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java @@ -21,7 +21,10 @@ 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.app.mgt.AppManagerConnectorException; +import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.spi.DeviceManager; +import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService; 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; @@ -34,7 +37,7 @@ import java.util.List; /** * This represents the Android implementation of DeviceManagerService. */ -public class AndroidDeviceManager implements DeviceManager { +public class AndroidDeviceManager implements DeviceMgtService { private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory; private static final Log log = LogFactory.getLog(AndroidDeviceManager.class); @@ -209,4 +212,9 @@ public class AndroidDeviceManager implements DeviceManager { return devices; } + @Override + public void installApplication(Operation operation, List deviceIdentifiers) + throws AppManagerConnectorException { + + } } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java index b3c3dfa493..96991d0b79 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java @@ -46,8 +46,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { } @Override - public boolean addFeature(MobileFeature mobileFeature) throws - MobileDeviceManagementDAOException { + public boolean addFeature(MobileFeature mobileFeature) throws MobileDeviceManagementDAOException { PreparedStatement stmt = null; boolean status = false; Connection conn = null; @@ -73,8 +72,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO { } @Override - public boolean updateFeature(MobileFeature mobileFeature) throws - MobileDeviceManagementDAOException { + public boolean updateFeature(MobileFeature mobileFeature) throws MobileDeviceManagementDAOException { boolean status = false; Connection conn = null; PreparedStatement stmt = null; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java index 79980100ae..9209cc20aa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java @@ -21,7 +21,10 @@ 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.app.mgt.AppManagerConnectorException; +import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.spi.DeviceManager; +import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService; 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; @@ -33,7 +36,7 @@ import java.util.List; /** * This represents the Windows implementation of DeviceManagerService. */ -public class WindowsDeviceManager implements DeviceManager { +public class WindowsDeviceManager implements DeviceMgtService { private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory; @@ -114,4 +117,9 @@ public class WindowsDeviceManager implements DeviceManager { return status; } + @Override + public void installApplication(Operation operation, List deviceIdentifiers) + throws AppManagerConnectorException { + + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementBundleActivator.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementBundleActivator.java index e2482e6926..ba1149454d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementBundleActivator.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementBundleActivator.java @@ -28,7 +28,6 @@ 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.AndroidDeviceManager; -import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManager; import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManager; import java.util.ArrayList; @@ -41,7 +40,6 @@ import java.util.Map; public class MobileDeviceManagementBundleActivator implements BundleActivator, BundleListener { private ServiceRegistration androidServiceRegRef; - private ServiceRegistration iOSServiceRegRef; private ServiceRegistration windowsServiceRegRef; private static List dataSourceListeners = @@ -70,9 +68,6 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B androidServiceRegRef = bundleContext.registerService(DeviceManager.class.getName(), new AndroidDeviceManager(), null); - iOSServiceRegRef = - bundleContext.registerService(DeviceManager.class.getName(), - new IOSDeviceManager(), null); windowsServiceRegRef = bundleContext.registerService(DeviceManager.class.getName(), new WindowsDeviceManager(), null); @@ -92,7 +87,6 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B } try { androidServiceRegRef.unregister(); - iOSServiceRegRef.unregister(); windowsServiceRegRef.unregister(); bundleContext.removeBundleListener(this); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java index 2c47e5bff9..9f8228e461 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java @@ -33,8 +33,6 @@ import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManager; import org.wso2.carbon.device.mgt.mobile.impl.android.dao.AndroidDAOFactory; -import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManager; -import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.IOSDAOFactory; import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManager; import org.wso2.carbon.ndatasource.core.DataSourceService; @@ -59,7 +57,6 @@ public class MobileDeviceManagementServiceComponent { private ServiceRegistration serverStartupObserverRef; private ServiceRegistration androidServiceRegRef; - private ServiceRegistration iOSServiceRegRef; private ServiceRegistration windowsServiceRegRef; private static final Log log = LogFactory.getLog(MobileDeviceManagementServiceComponent.class); @@ -78,8 +75,7 @@ public class MobileDeviceManagementServiceComponent { Map dsConfigMap = config.getMobileDeviceMgtRepository().getMobileDataSourceConfigMap(); MobileDeviceManagementDAOFactory.setMobileDataSourceConfigMap(dsConfigMap); - IOSDAOFactory.init(dsConfigMap.get(DeviceManagementConstants.MobileDeviceTypes. - MOBILE_DEVICE_TYPE_IOS)); + AndroidDAOFactory .init(dsConfigMap.get(DeviceManagementConstants.MobileDeviceTypes. MOBILE_DEVICE_TYPE_ANDROID)); @@ -105,8 +101,6 @@ public class MobileDeviceManagementServiceComponent { androidServiceRegRef = bundleContext.registerService(DeviceManager.class.getName(), new AndroidDeviceManager(), null); - iOSServiceRegRef = - bundleContext.registerService(DeviceManager.class.getName(), new IOSDeviceManager(), null); windowsServiceRegRef = bundleContext.registerService(DeviceManager.class.getName(), new WindowsDeviceManager(), null); @@ -126,9 +120,6 @@ public class MobileDeviceManagementServiceComponent { if (androidServiceRegRef != null) { androidServiceRegRef.unregister(); } - if (iOSServiceRegRef != null) { - iOSServiceRegRef.unregister(); - } if (windowsServiceRegRef != null) { windowsServiceRegRef.unregister(); }