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 8226ca1fe0..18f3cb20a1 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 @@ -33,7 +33,7 @@ ${project.artifactId} ${project.artifactId} ${project.version} - Device Management Core Bundle + Device Management Mobile Impl Bundle org.wso2.carbon.device.mgt.mobile.impl.internal org.osgi.framework, @@ -72,6 +72,11 @@ org.wso2.carbon org.wso2.carbon.logging + + org.eclipse.osgi + org.eclipse.osgi.services + 3.2.0.v20090520-1800 + \ 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/internal/MobileDeviceMgtServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java index e1a8817952..af66453e64 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java @@ -16,8 +16,49 @@ package org.wso2.carbon.device.mgt.mobile.impl.internal; +import org.apache.commons.logging.LogFactory; +import org.apache.commons.logging.Log; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.component.ComponentContext; +import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; +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.windows.WindowsDeviceManagerService; + /** - * Created by harshan on 12/4/14. + * @scr.component name="org.wso2.carbon.device.manager.mobile" immediate="true" */ public class MobileDeviceMgtServiceComponent { + + private static final Log log = LogFactory.getLog(MobileDeviceMgtServiceComponent.class); + ServiceRegistration serviceRegistration; + + protected void activate(ComponentContext ctx) { + try { + if (log.isDebugEnabled()) { + log.debug("Activating Mobile Device Management Service"); + } + AndroidDeviceManagerService androidDeviceMgrService = new AndroidDeviceManagerService(); + IOSDeviceManagerService iOSDeviceMgrService = new IOSDeviceManagerService(); + WindowsDeviceManagerService windowsDeviceMgrService = new WindowsDeviceManagerService(); + serviceRegistration = + ctx.getBundleContext().registerService(DeviceManagerService.class.getName(), + androidDeviceMgrService, null); + serviceRegistration = + ctx.getBundleContext().registerService(DeviceManagerService.class.getName(), + iOSDeviceMgrService, null); + serviceRegistration = + ctx.getBundleContext().registerService(DeviceManagerService.class.getName(), + windowsDeviceMgrService, null); + } catch (Throwable e) { + log.error("Unable to activate Mobile Device Management Service Component", e); + } + } + + protected void deactivate(ComponentContext ctx) { + if (log.isDebugEnabled()) { + log.debug("Deactivating Mobile Device Management Service"); + } + serviceRegistration.unregister(); + } }