|
|
@ -26,6 +26,7 @@ import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
|
|
|
|
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
|
|
|
|
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
|
|
|
|
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
|
|
|
|
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationProvider;
|
|
|
|
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
|
|
|
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent;
|
|
|
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent;
|
|
|
@ -137,10 +138,16 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
deviceTypeIdentifier = new DeviceTypeIdentifier(deviceManagementService.getType(), tenantId);
|
|
|
|
deviceTypeIdentifier = new DeviceTypeIdentifier(deviceManagementService.getType(), tenantId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pushNoteConfig != null) {
|
|
|
|
if (pushNoteConfig != null) {
|
|
|
|
NotificationStrategy notificationStrategy =
|
|
|
|
PushNotificationProvider provider = DeviceManagementDataHolder.getInstance()
|
|
|
|
DeviceManagementDataHolder.getInstance().getPushNotificationProviderRepository().getProvider(
|
|
|
|
.getPushNotificationProviderRepository().getProvider(pushNoteConfig.getType());
|
|
|
|
pushNoteConfig.getType()).getNotificationStrategy(pushNoteConfig);
|
|
|
|
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(
|
|
|
|
operationManagerRepository.addOperationManager(deviceTypeIdentifier, new OperationManagerImpl(
|
|
|
|
notificationStrategy));
|
|
|
|
notificationStrategy));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -172,7 +179,8 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|
|
|
deviceTypeName = provider.getType().toLowerCase();
|
|
|
|
deviceTypeName = provider.getType().toLowerCase();
|
|
|
|
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
|
|
|
|
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
|
|
|
|
int tenantId = DeviceManagerUtil.getTenantId(provisioningConfig.getProviderTenantDomain());
|
|
|
|
int tenantId = DeviceManagerUtil.getTenantId(provisioningConfig.getProviderTenantDomain());
|
|
|
|
DeviceManagerUtil.registerDeviceType(deviceTypeName, tenantId, provisioningConfig.isSharedWithAllTenants());
|
|
|
|
DeviceManagerUtil.registerDeviceType(deviceTypeName, tenantId,
|
|
|
|
|
|
|
|
provisioningConfig.isSharedWithAllTenants());
|
|
|
|
registerPushNotificationStrategy(provider);
|
|
|
|
registerPushNotificationStrategy(provider);
|
|
|
|
//TODO:
|
|
|
|
//TODO:
|
|
|
|
//This is a temporory fix.
|
|
|
|
//This is a temporory fix.
|
|
|
@ -180,7 +188,8 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|
|
|
//until fix that, use following variable to enable and disable of checking user authorization.
|
|
|
|
//until fix that, use following variable to enable and disable of checking user authorization.
|
|
|
|
|
|
|
|
|
|
|
|
DeviceManagementDataHolder.getInstance().setRequireDeviceAuthorization(provider.getType(),
|
|
|
|
DeviceManagementDataHolder.getInstance().setRequireDeviceAuthorization(provider.getType(),
|
|
|
|
provider.getDeviceManager().requireDeviceAuthorization());
|
|
|
|
provider.getDeviceManager()
|
|
|
|
|
|
|
|
.requireDeviceAuthorization());
|
|
|
|
} catch (Throwable e) {
|
|
|
|
} catch (Throwable e) {
|
|
|
|
/* Throwable is caught intentionally as failure of one plugin - due to invalid start up parameters,
|
|
|
|
/* 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 */
|
|
|
|
etc - should not block the initialization of other device management providers */
|
|
|
|