当前位置: 首页>>代码示例>>Java>>正文


Java DeviceManagementService.getType方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:27,代码来源:DeviceManagementPluginRepository.java

示例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);
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:23,代码来源:DeviceManagementPluginRepository.java

示例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);
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:17,代码来源:DeviceManagementPluginRepository.java

示例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);
            }
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:20,代码来源:DeviceManagementPluginRepository.java

示例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);
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:DeviceManagementPluginRepository.java

示例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();
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:36,代码来源:DeviceManagementPluginRepository.java

示例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;
    }
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:46,代码来源:DeviceManagementPluginRepository.java


注:本文中的org.wso2.carbon.device.mgt.common.spi.DeviceManagementService.getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。