diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index 914f3d5173..c4834b1862 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -33,6 +33,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository; +import org.wso2.carbon.device.mgt.core.api.mgt.ApplicationManagementProviderService; import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig; import org.wso2.carbon.device.mgt.core.app.mgt.oauth.ServiceAuthenticator; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; @@ -51,7 +52,7 @@ import java.util.List; * Implements Application Manager interface * */ -public class ApplicationManagerProviderServiceImpl implements ApplicationManager { +public class ApplicationManagerProviderServiceImpl implements ApplicationManagementProviderService { private ConfigurationContext configCtx; private ServiceAuthenticator authenticator; @@ -155,4 +156,19 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManager return pluginRepository; } + @Override + public void updateApplicationListInstallInDevice(DeviceIdentifier deviceIdentifier,List applications) + throws ApplicationManagementException { + + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + try { + Device device = deviceDAO.getDevice(deviceIdentifier, tenantId); + deviceDAO.addDeviceApplications(device.getId(), applications); + }catch (DeviceManagementDAOException deviceDaoEx){ + String errorMsg = "Error occurred saving application list to the device"; + log.error(errorMsg+":"+deviceIdentifier.toString()); + throw new ApplicationManagementException(errorMsg, deviceDaoEx); + } + + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java index baa49db7a3..ecdf4b7b31 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java @@ -37,6 +37,7 @@ import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository; import org.wso2.carbon.device.mgt.core.api.mgt.APIPublisherService; import org.wso2.carbon.device.mgt.core.api.mgt.APIPublisherServiceImpl; import org.wso2.carbon.device.mgt.core.api.mgt.APIRegistrationStartupObserver; +import org.wso2.carbon.device.mgt.core.api.mgt.ApplicationManagementProviderService; import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementServiceImpl; import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagerProviderServiceImpl; import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig; @@ -200,7 +201,7 @@ public class DeviceManagementServiceComponent { bundleContext.registerService(ServerStartupObserver.class, new APIRegistrationStartupObserver(), null); /* Registering App Management service */ - bundleContext.registerService(ApplicationManager.class.getName(), new ApplicationManagementServiceImpl(), null); + bundleContext.registerService(ApplicationManagementProviderService.class.getName(), new ApplicationManagementServiceImpl(), null); } private void setupDeviceManagementSchema(DataSourceConfig config) throws DeviceManagementException {