Added service registrations to Mobile DeviceManagerService component .

revert-dabc3590
harshanL 10 years ago
parent b94d6edfce
commit 843322d33f

@ -33,7 +33,7 @@
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Description>Device Management Core Bundle</Bundle-Description>
<Bundle-Description>Device Management Mobile Impl Bundle</Bundle-Description>
<Private-Package>org.wso2.carbon.device.mgt.mobile.impl.internal</Private-Package>
<Import-Package>
org.osgi.framework,
@ -72,6 +72,11 @@
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
<version>3.2.0.v20090520-1800</version>
</dependency>
</dependencies>
</project>

@ -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();
}
}

Loading…
Cancel
Save