本文整理汇总了Java中org.wso2.carbon.device.mgt.common.spi.DeviceManagementService.getType方法的典型用法代码示例。如果您正苦于以下问题:Java DeviceManagementService.getType方法的具体用法?Java DeviceManagementService.getType怎么用?Java DeviceManagementService.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.device.mgt.common.spi.DeviceManagementService
的用法示例。
在下文中一共展示了DeviceManagementService.getType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
}
示例7: notifyObserver
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; //导入方法依赖的package包/类
@Override
public void notifyObserver() {
String deviceTypeName;
synchronized (providers) {
for (DeviceManagementServiceHolder deviceManagementServiceHolder : providers.values()) {
DeviceManagementService provider= deviceManagementServiceHolder.getDeviceManagementService();
try {
provider.init();
deviceTypeName = provider.getType();
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
int tenantId = DeviceManagerUtil.getTenantId(provisioningConfig.getProviderTenantDomain());
DeviceTypeMetaDefinition deviceTypeDefinition = null;
if (provider instanceof DeviceTypeDefinitionProvider) {
deviceTypeDefinition = ((DeviceTypeDefinitionProvider) provider).getDeviceTypeMetaDefinition();
DeviceTypeServiceIdentifier deviceTypeIdentifier = new DeviceTypeServiceIdentifier(
provider.getType(), tenantId);
DeviceManagementServiceHolder existingProvider = providers.get(deviceTypeIdentifier);
if (existingProvider != null) {
removeDeviceManagementProvider(provider);
}
}
DeviceManagerUtil.registerDeviceType(deviceTypeName, tenantId
, provisioningConfig.isSharedWithAllTenants(), deviceTypeDefinition);
registerPushNotificationStrategy(provider);
registerMonitoringTask(provider);
//TODO:
//This is a temporory fix.
//windows and IOS cannot resolve user info by extracting certs
//until fix that, use following variable to enable and disable of checking user authorization.
DeviceManagementDataHolder.getInstance().setRequireDeviceAuthorization(provider.getType(),
provider.getDeviceManager()
.requireDeviceAuthorization());
} catch (Throwable e) {
/* Throwable is caught intentionally as failure of one plugin - due to invalid start up parameters,
etc - should not block the initialization of other device management providers */
log.error("Error occurred while initializing device management provider '" +
provider.getType() + "'", e);
}
}
this.isInitiated = true;
}
}