|
|
@ -71,6 +71,9 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|
|
|
String deviceType = provider.getType();
|
|
|
|
String deviceType = provider.getType();
|
|
|
|
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
|
|
|
|
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
|
|
|
|
String tenantDomain = provisioningConfig.getProviderTenantDomain();
|
|
|
|
String tenantDomain = provisioningConfig.getProviderTenantDomain();
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug(deviceType + " device type is added for tenant : " + tenantDomain);
|
|
|
|
|
|
|
|
}
|
|
|
|
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig();
|
|
|
|
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig();
|
|
|
|
boolean isSharedWithAllTenants = provisioningConfig.isSharedWithAllTenants();
|
|
|
|
boolean isSharedWithAllTenants = provisioningConfig.isSharedWithAllTenants();
|
|
|
|
int tenantId = DeviceManagerUtil.getTenantId(tenantDomain);
|
|
|
|
int tenantId = DeviceManagerUtil.getTenantId(tenantDomain);
|
|
|
@ -125,6 +128,9 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|
|
|
public void removeDeviceManagementProvider(DeviceManagementService provider)
|
|
|
|
public void removeDeviceManagementProvider(DeviceManagementService provider)
|
|
|
|
throws DeviceManagementException {
|
|
|
|
throws DeviceManagementException {
|
|
|
|
String deviceTypeName = provider.getType();
|
|
|
|
String deviceTypeName = provider.getType();
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug(deviceTypeName + " device type is removed.");
|
|
|
|
|
|
|
|
}
|
|
|
|
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance()
|
|
|
|
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance()
|
|
|
|
.getDeviceManagementConfig();
|
|
|
|
.getDeviceManagementConfig();
|
|
|
|
DeviceTypeServiceIdentifier deviceTypeIdentifier;
|
|
|
|
DeviceTypeServiceIdentifier deviceTypeIdentifier;
|
|
|
@ -152,6 +158,14 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|
|
|
private void unregisterPushNotificationStrategy(DeviceTypeServiceIdentifier deviceTypeIdentifier) {
|
|
|
|
private void unregisterPushNotificationStrategy(DeviceTypeServiceIdentifier deviceTypeIdentifier) {
|
|
|
|
OperationManager operationManager = operationManagerRepository.getOperationManager(
|
|
|
|
OperationManager operationManager = operationManagerRepository.getOperationManager(
|
|
|
|
deviceTypeIdentifier);
|
|
|
|
deviceTypeIdentifier);
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug(deviceTypeIdentifier.getDeviceType() + " device type management service is " +
|
|
|
|
|
|
|
|
"retrieved for tenant id: " + deviceTypeIdentifier.getTenantId());
|
|
|
|
|
|
|
|
for (Map.Entry<DeviceTypeServiceIdentifier, DeviceManagementServiceHolder> entry : providers.entrySet()) {
|
|
|
|
|
|
|
|
log.debug("Device Type : " + entry.getKey().getDeviceType() + " Tenant Id : " +
|
|
|
|
|
|
|
|
entry.getKey().getTenantId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (operationManager != null) {
|
|
|
|
if (operationManager != null) {
|
|
|
|
NotificationStrategy notificationStrategy = operationManager.getNotificationStrategy();
|
|
|
|
NotificationStrategy notificationStrategy = operationManager.getNotificationStrategy();
|
|
|
|
if (notificationStrategy != null) {
|
|
|
|
if (notificationStrategy != null) {
|
|
|
@ -165,6 +179,13 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|
|
|
//Priority need to be given to the tenant before public.
|
|
|
|
//Priority need to be given to the tenant before public.
|
|
|
|
DeviceTypeServiceIdentifier deviceTypeIdentifier = new DeviceTypeServiceIdentifier(type, tenantId);
|
|
|
|
DeviceTypeServiceIdentifier deviceTypeIdentifier = new DeviceTypeServiceIdentifier(type, tenantId);
|
|
|
|
DeviceManagementServiceHolder provider = providers.get(deviceTypeIdentifier);
|
|
|
|
DeviceManagementServiceHolder provider = providers.get(deviceTypeIdentifier);
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug(type + " device type management service is retrieved for tenant id: " + tenantId);
|
|
|
|
|
|
|
|
for (Map.Entry<DeviceTypeServiceIdentifier, DeviceManagementServiceHolder> entry : providers.entrySet()) {
|
|
|
|
|
|
|
|
log.debug("Device Type : " + entry.getKey().getDeviceType() + " Tenant Id : " +
|
|
|
|
|
|
|
|
entry.getKey().getTenantId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (provider == null) {
|
|
|
|
if (provider == null) {
|
|
|
|
deviceTypeIdentifier = new DeviceTypeServiceIdentifier(type);
|
|
|
|
deviceTypeIdentifier = new DeviceTypeServiceIdentifier(type);
|
|
|
|
provider = providers.get(deviceTypeIdentifier);
|
|
|
|
provider = providers.get(deviceTypeIdentifier);
|
|
|
@ -310,6 +331,9 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|
|
|
DeviceTaskManagerService deviceTaskManagerService = DeviceManagementDataHolder.getInstance().
|
|
|
|
DeviceTaskManagerService deviceTaskManagerService = DeviceManagementDataHolder.getInstance().
|
|
|
|
getDeviceTaskManagerService();
|
|
|
|
getDeviceTaskManagerService();
|
|
|
|
DeviceStatusTaskPluginConfig deviceStatusTaskPluginConfig = deviceManagementService.getDeviceStatusTaskPluginConfig();
|
|
|
|
DeviceStatusTaskPluginConfig deviceStatusTaskPluginConfig = deviceManagementService.getDeviceStatusTaskPluginConfig();
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug(deviceType + " device type status monitoring task is registered.");
|
|
|
|
|
|
|
|
}
|
|
|
|
if (deviceStatusTaskPluginConfig != null && deviceStatusTaskPluginConfig.isRequireStatusMonitoring()) {
|
|
|
|
if (deviceStatusTaskPluginConfig != null && deviceStatusTaskPluginConfig.isRequireStatusMonitoring()) {
|
|
|
|
if (deviceTaskManagerService == null) {
|
|
|
|
if (deviceTaskManagerService == null) {
|
|
|
|
DeviceManagementDataHolder.getInstance().addDeviceStatusTaskPluginConfig(deviceType,
|
|
|
|
DeviceManagementDataHolder.getInstance().addDeviceStatusTaskPluginConfig(deviceType,
|
|
|
@ -330,6 +354,9 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|
|
|
DeviceStatusTaskManagerService deviceStatusTaskManagerService = DeviceManagementDataHolder.getInstance().
|
|
|
|
DeviceStatusTaskManagerService deviceStatusTaskManagerService = DeviceManagementDataHolder.getInstance().
|
|
|
|
getDeviceStatusTaskManagerService();
|
|
|
|
getDeviceStatusTaskManagerService();
|
|
|
|
DeviceStatusTaskPluginConfig deviceStatusTaskPluginConfig = deviceManagementService.getDeviceStatusTaskPluginConfig();
|
|
|
|
DeviceStatusTaskPluginConfig deviceStatusTaskPluginConfig = deviceManagementService.getDeviceStatusTaskPluginConfig();
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug(deviceType + " device type status monitoring task is unregistered.");
|
|
|
|
|
|
|
|
}
|
|
|
|
if (deviceStatusTaskPluginConfig != null && deviceStatusTaskPluginConfig.isRequireStatusMonitoring()) {
|
|
|
|
if (deviceStatusTaskPluginConfig != null && deviceStatusTaskPluginConfig.isRequireStatusMonitoring()) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
DeviceManagementDataHolder.getInstance().removeDeviceStatusTaskPluginConfig(deviceType);
|
|
|
|
DeviceManagementDataHolder.getInstance().removeDeviceStatusTaskPluginConfig(deviceType);
|
|
|
@ -346,6 +373,9 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|
|
|
public OperationManager getOperationManager(String deviceType, int tenantId) {
|
|
|
|
public OperationManager getOperationManager(String deviceType, int tenantId) {
|
|
|
|
//Priority need to be given to the tenant before public.
|
|
|
|
//Priority need to be given to the tenant before public.
|
|
|
|
DeviceTypeServiceIdentifier deviceTypeIdentifier = new DeviceTypeServiceIdentifier(deviceType, tenantId);
|
|
|
|
DeviceTypeServiceIdentifier deviceTypeIdentifier = new DeviceTypeServiceIdentifier(deviceType, tenantId);
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug(deviceType + " device type operation manager is retrieved for tenant: ." + tenantId);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (getDeviceManagementService(deviceType, tenantId) == null) {
|
|
|
|
if (getDeviceManagementService(deviceType, tenantId) == null) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|