本文整理汇总了Java中org.wso2.carbon.device.mgt.common.spi.DeviceManagementService类的典型用法代码示例。如果您正苦于以下问题:Java DeviceManagementService类的具体用法?Java DeviceManagementService怎么用?Java DeviceManagementService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeviceManagementService类属于org.wso2.carbon.device.mgt.common.spi包,在下文中一共展示了DeviceManagementService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeDeviceManagementProvider
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
public void removeDeviceManagementProvider(DeviceManagementService provider)
throws DeviceManagementException {
String deviceTypeName = provider.getType();
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance()
.getDeviceManagementConfig();
DeviceTypeServiceIdentifier deviceTypeIdentifier;
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
if (provisioningConfig.isSharedWithAllTenants()) {
deviceTypeIdentifier = new DeviceTypeServiceIdentifier(deviceTypeName);
} else {
int providerTenantId = DeviceManagerUtil.getTenantId(provisioningConfig.getProviderTenantDomain());
deviceTypeIdentifier = new DeviceTypeServiceIdentifier(deviceTypeName, providerTenantId);
}
PullNotificationSubscriber pullNotificationSubscriber = provider.getPullNotificationSubscriber();
if (pullNotificationSubscriber != null) {
pullNotificationSubscriber.clean();
}
providers.remove(deviceTypeIdentifier);
unregisterPushNotificationStrategy(deviceTypeIdentifier);
unregisterMonitoringTask(provider);
if (deviceManagementConfig != null && deviceManagementConfig.getDeviceStatusTaskConfig().isEnabled()) {
DeviceType deviceTypeObj = DeviceManagerUtil.getDeviceType(deviceTypeIdentifier.getDeviceType(),
deviceTypeIdentifier.getTenantId());
unregisterDeviceStatusMonitoringTask(deviceTypeObj, provider);
}
}
示例2: registerMonitoringTask
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
private void registerMonitoringTask(DeviceManagementService deviceManagementService)
throws DeviceManagementException {
try {
DeviceTaskManagerService deviceTaskManagerService = DeviceManagementDataHolder.getInstance().
getDeviceTaskManagerService();
OperationMonitoringTaskConfig operationMonitoringTaskConfig = deviceManagementService.
getOperationMonitoringConfig();
if (operationMonitoringTaskConfig != null && operationMonitoringTaskConfig.isEnabled()) {
if (deviceTaskManagerService == null) {
DeviceMonitoringOperationDataHolder.getInstance().addOperationMonitoringConfigToMap(
deviceManagementService.getType(), operationMonitoringTaskConfig);
} else {
deviceTaskManagerService.startTask(deviceManagementService.getType(),
operationMonitoringTaskConfig);
}
}
} catch (DeviceMgtTaskException e) {
throw new DeviceManagementException("Error occurred while adding task service for '" +
deviceManagementService.getType() + "'", e);
}
}
示例3: unregisterMonitoringTask
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
private void unregisterMonitoringTask(DeviceManagementService deviceManagementService)
throws DeviceManagementException {
try {
DeviceTaskManagerService deviceTaskManagerService = DeviceManagementDataHolder.getInstance().
getDeviceTaskManagerService();
OperationMonitoringTaskConfig operationMonitoringTaskConfig = deviceManagementService.
getOperationMonitoringConfig();
if (operationMonitoringTaskConfig != null) {
deviceTaskManagerService.stopTask(deviceManagementService.getType(),
deviceManagementService.getOperationMonitoringConfig());
}
} catch (DeviceMgtTaskException e) {
throw new DeviceManagementException("Error occurred while removing task service for '" +
deviceManagementService.getType() + "'", e);
}
}
示例4: registerDeviceStatusMonitoringTask
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
private void registerDeviceStatusMonitoringTask(DeviceType deviceType, DeviceManagementService deviceManagementService) throws
DeviceManagementException {
DeviceTaskManagerService deviceTaskManagerService = DeviceManagementDataHolder.getInstance().
getDeviceTaskManagerService();
DeviceStatusTaskPluginConfig deviceStatusTaskPluginConfig = deviceManagementService.getDeviceStatusTaskPluginConfig();
if (deviceStatusTaskPluginConfig != null && deviceStatusTaskPluginConfig.isRequireStatusMonitoring()) {
if (deviceTaskManagerService == null) {
DeviceManagementDataHolder.getInstance().addDeviceStatusTaskPluginConfig(deviceType,
deviceStatusTaskPluginConfig);
} else {
try {
new DeviceStatusTaskManagerServiceImpl().startTask(deviceType, deviceStatusTaskPluginConfig);
} catch (DeviceStatusTaskException e) {
throw new DeviceManagementException("Error occurred while adding Device Status task service for '" +
deviceManagementService.getType() + "'", e);
}
}
}
}
示例5: unregisterDeviceStatusMonitoringTask
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
private void unregisterDeviceStatusMonitoringTask(DeviceType deviceType, DeviceManagementService deviceManagementService) throws
DeviceManagementException {
DeviceStatusTaskManagerService deviceStatusTaskManagerService = DeviceManagementDataHolder.getInstance().
getDeviceStatusTaskManagerService();
DeviceStatusTaskPluginConfig deviceStatusTaskPluginConfig = deviceManagementService.getDeviceStatusTaskPluginConfig();
if (deviceStatusTaskPluginConfig != null && deviceStatusTaskPluginConfig.isRequireStatusMonitoring()) {
try {
DeviceManagementDataHolder.getInstance().removeDeviceStatusTaskPluginConfig(deviceType);
if (deviceStatusTaskManagerService != null) {
deviceStatusTaskManagerService.stopTask(deviceType, deviceStatusTaskPluginConfig);
}
} catch (DeviceStatusTaskException e) {
throw new DeviceManagementException("Error occurred while stopping Device Status task service for '" +
deviceManagementService.getType() + "'", e);
}
}
}
示例6: setDeviceManagementService
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
/**
* Sets Device Manager service.
*
* @param deviceManagementService An instance of DeviceManagementService
*/
protected void setDeviceManagementService(DeviceManagementService deviceManagementService) {
try {
if (log.isDebugEnabled()) {
log.debug("Setting Device Management Service Provider: '" +
deviceManagementService.getType() + "'");
}
synchronized (LOCK) {
deviceManagers.add(deviceManagementService);
for (PluginInitializationListener listener : listeners) {
listener.registerDeviceManagementService(deviceManagementService);
}
}
log.info("Device Type deployed successfully : " + deviceManagementService.getType() + " for tenant "
+ deviceManagementService.getProvisioningConfig().getProviderTenantDomain());
} catch (Throwable e) {
log.error("Failed to register device management service for device type" + deviceManagementService.getType() +
" for tenant " + deviceManagementService.getProvisioningConfig().getProviderTenantDomain(), e);
}
}
示例7: activate
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
protected void activate(ComponentContext ctx) {
if (log.isDebugEnabled()) {
log.debug("Activating Firealarm Device Management Service Component");
}
try {
BundleContext bundleContext = ctx.getBundleContext();
firealarmServiceRegRef =
bundleContext.registerService(DeviceManagementService.class.getName(),
new FireAlarmManagerService(),
null);
if (log.isDebugEnabled()) {
log.debug("Firealarm Device Management Service Component has been successfully activated");
}
} catch (Throwable e) {
log.error("Error occurred while activating Firealarm Device Management Service Component", e);
}
}
开发者ID:wso2-incubator,项目名称:iot-server-appliances,代码行数:23,代码来源:FirealarmManagementServiceComponent.java
示例8: activate
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
protected void activate(ComponentContext ctx) {
if (log.isDebugEnabled()) {
log.debug("Activating Connected Cup Service Component");
}
try {
BundleContext bundleContext = ctx.getBundleContext();
connectedCupServiceRegRef =
bundleContext.registerService(DeviceManagementService.class.getName(),
new ConnectedCupManagerService(), null);
if (log.isDebugEnabled()) {
log.debug("Connected Cup Service Component has been successfully activated");
}
} catch (Throwable e) {
log.error("Error occurred while activating Connected Cup Service Component", e);
}
}
示例9: registerDeviceType
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
protected ServiceRegistration registerDeviceType(DeviceTypeConfigIdentifier deviceTypeConfigIdentifier,
DeviceTypeConfiguration deviceManagementConfiguration) {
DeviceTypeManagerService deviceTypeManagerService = new DeviceTypeManagerService(deviceTypeConfigIdentifier,
deviceManagementConfiguration);
BundleContext bundleContext = DeviceTypeManagementDataHolder.getInstance().getBundleContext();
return bundleContext.registerService(DeviceManagementService.class.getName(), deviceTypeManagerService, null);
}
示例10: getAllDeviceManagementServices
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
public Map<DeviceTypeServiceIdentifier, DeviceManagementService> getAllDeviceManagementServices(int tenantId) {
Map<DeviceTypeServiceIdentifier, DeviceManagementService> tenantProviders = new HashMap<>();
for (DeviceTypeServiceIdentifier identifier : providers.keySet()) {
if (identifier.getTenantId() == tenantId || identifier.isSharedWithAllTenant()) {
tenantProviders.put(identifier, providers.get(identifier).getDeviceManagementService());
}
}
return tenantProviders;
}
示例11: registerPushNotificationStrategy
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
private void registerPushNotificationStrategy(DeviceManagementService deviceManagementService)
throws DeviceManagementException {
PushNotificationConfig pushNoteConfig = deviceManagementService.getPushNotificationConfig();
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(
deviceManagementService.getProvisioningConfig().getProviderTenantDomain(), true);
try {
boolean isSharedWithAllTenants = deviceManagementService.getProvisioningConfig().isSharedWithAllTenants();
DeviceTypeServiceIdentifier deviceTypeIdentifier;
if (isSharedWithAllTenants) {
deviceTypeIdentifier = new DeviceTypeServiceIdentifier(deviceManagementService.getType());
} else {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
deviceTypeIdentifier = new DeviceTypeServiceIdentifier(deviceManagementService.getType(), tenantId);
}
if (pushNoteConfig != null) {
PushNotificationProvider provider = DeviceManagementDataHolder.getInstance()
.getPushNotificationProviderRepository().getProvider(pushNoteConfig.getType());
if (provider == null) {
throw new DeviceManagementException(
"No registered push notification provider found for the type: '" +
pushNoteConfig.getType() + "'.");
}
NotificationStrategy notificationStrategy = provider.getNotificationStrategy(pushNoteConfig);
operationManagerRepository.addOperationManager(deviceTypeIdentifier,
new OperationManagerImpl(deviceTypeIdentifier.getDeviceType(), notificationStrategy));
} else {
operationManagerRepository.addOperationManager(deviceTypeIdentifier,
new OperationManagerImpl(deviceTypeIdentifier.getDeviceType()));
}
} finally {
PrivilegedCarbonContext.endTenantFlow();
}
}
示例12: getMonitoringOperationList
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
@Override
public List<MonitoringOperation> getMonitoringOperationList(String deviceType) {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
DeviceManagementService dms = pluginRepository.getDeviceManagementService(deviceType, tenantId);
OperationMonitoringTaskConfig operationMonitoringTaskConfig = dms.getOperationMonitoringConfig();
return operationMonitoringTaskConfig.getMonitoringOperation();
}
示例13: getDeviceMonitoringFrequency
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
@Override
public int getDeviceMonitoringFrequency(String deviceType) {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
DeviceManagementService dms = pluginRepository.getDeviceManagementService(deviceType, tenantId);
OperationMonitoringTaskConfig operationMonitoringTaskConfig = dms.getOperationMonitoringConfig();
return operationMonitoringTaskConfig.getFrequency();
}
示例14: isDeviceMonitoringEnabled
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
@Override
public boolean isDeviceMonitoringEnabled(String deviceType) {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
DeviceManagementService dms = pluginRepository.getDeviceManagementService(deviceType, tenantId);
OperationMonitoringTaskConfig operationMonitoringTaskConfig = dms.getOperationMonitoringConfig();
return operationMonitoringTaskConfig.isEnabled();
}
示例15: getDeviceManager
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入依赖的package包/类
private DeviceManager getDeviceManager(String deviceType) {
DeviceManagementService deviceManagementService =
pluginRepository.getDeviceManagementService(deviceType, this.getTenantId());
if (deviceManagementService == null) {
if (log.isDebugEnabled()) {
log.debug("Device type '" + deviceType + "' does not have an associated device management " +
"plugin registered within the framework. Therefore, returning null");
}
return null;
}
return deviceManagementService.getDeviceManager();
}