Search in sources :

Example 1 with DeviceManagementProviderService

use of org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService in project product-iots by wso2.

the class APIUtil method getDeviceManagementService.

public static DeviceManagementProviderService getDeviceManagementService() {
    PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
    DeviceManagementProviderService deviceManagementProviderService = (DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null);
    if (deviceManagementProviderService == null) {
        throw new IllegalStateException("Device Management service has not initialized");
    }
    return deviceManagementProviderService;
}
Also used : PrivilegedCarbonContext(org.wso2.carbon.context.PrivilegedCarbonContext) DeviceManagementProviderService(org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService)

Example 2 with DeviceManagementProviderService

use of org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService in project product-iots by wso2.

the class APIUtil method getDeviceManagementService.

/**
 * @return Device management service of current context
 */
public static DeviceManagementProviderService getDeviceManagementService() {
    PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
    DeviceManagementProviderService deviceManagementProviderService = (DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null);
    if (deviceManagementProviderService == null) {
        String msg = "Device Management service has not initialized.";
        log.error(msg);
        throw new IllegalStateException(msg);
    }
    return deviceManagementProviderService;
}
Also used : PrivilegedCarbonContext(org.wso2.carbon.context.PrivilegedCarbonContext) DeviceManagementProviderService(org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService)

Aggregations

PrivilegedCarbonContext (org.wso2.carbon.context.PrivilegedCarbonContext)2 DeviceManagementProviderService (org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService)2