Search in sources :

Example 1 with DeviceTypeManagerService

use of org.wso2.iot.sampledevice.plugin.impl.DeviceTypeManagerService in project product-iots by wso2.

the class ServiceComponent method activate.

protected void activate(ComponentContext ctx) {
    if (log.isDebugEnabled()) {
        log.debug("Activating b Management Service Component");
    }
    try {
        DeviceTypeManagerService deviceTypeManagerService = new DeviceTypeManagerService();
        BundleContext bundleContext = ctx.getBundleContext();
        serviceRegistration = bundleContext.registerService(DeviceManagementService.class.getName(), deviceTypeManagerService, null);
        String setupOption = System.getProperty("setup");
        if (setupOption != null) {
            if (log.isDebugEnabled()) {
                log.debug("-Dsetup is enabled. Iot Device management repository schema " + "initialization is about to begin");
            }
            try {
                DeviceTypeUtils.setupDeviceManagementSchema();
            } catch (DeviceMgtPluginException e) {
                log.error("Exception occurred while initializing device management database " + "schema", e);
            }
        }
        if (log.isDebugEnabled()) {
            log.debug("b Management Service Component has been successfully activated");
        }
    } catch (Throwable e) {
        log.error("Error occurred while activating Current Sensor Management Service " + "Component", e);
    }
}
Also used : DeviceMgtPluginException(org.wso2.iot.sampledevice.plugin.exception.DeviceMgtPluginException) DeviceTypeManagerService(org.wso2.iot.sampledevice.plugin.impl.DeviceTypeManagerService) BundleContext(org.osgi.framework.BundleContext)

Aggregations

BundleContext (org.osgi.framework.BundleContext)1 DeviceMgtPluginException (org.wso2.iot.sampledevice.plugin.exception.DeviceMgtPluginException)1 DeviceTypeManagerService (org.wso2.iot.sampledevice.plugin.impl.DeviceTypeManagerService)1