diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index e66aebc504c..4771053b49b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -80,7 +80,8 @@ org.wso2.carbon.apimgt.api.model, org.wso2.carbon.apimgt.impl, org.wso2.carbon.identity.oauth.stub, - org.wso2.carbon.identity.oauth.stub.dto + org.wso2.carbon.identity.oauth.stub.dto, + org.wso2.carbon.ndatasource.core !org.wso2.carbon.device.mgt.core.internal, @@ -132,6 +133,10 @@ org.wso2.carbon org.wso2.carbon.core + + org.wso2.carbon + org.wso2.carbon.ndatasource.core + com.h2database.wso2 h2-database-engine 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 2cc370a15c6..3fe93d1fb4a 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 @@ -50,6 +50,7 @@ import org.wso2.carbon.device.mgt.core.service.AppManager; import org.wso2.carbon.device.mgt.core.service.DeviceManagementService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementServiceImpl; import org.wso2.carbon.device.mgt.core.util.DeviceManagementSchemaInitializer; +import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.service.RealmService; @@ -82,6 +83,12 @@ import java.util.List; * policy="dynamic" * bind="setAPIManagerConfigurationService" * unbind="unsetAPIManagerConfigurationService" + * @scr.reference name="org.wso2.carbon.ndatasource" + * interface="org.wso2.carbon.ndatasource.core.DataSourceService" + * cardinality="1..1" + * policy="dynamic" + * bind="setDataSourceService" + * unbind="unsetDataSourceService" */ public class DeviceManagementServiceComponent { @@ -312,4 +319,15 @@ public class DeviceManagementServiceComponent { //do nothing } + protected void setDataSourceService(DataSourceService dataSourceService) { + /* This is to avoid mobile device management component getting initialized before the underlying datasources + are registered */ + if (log.isDebugEnabled()) { + log.debug("Data source service set to mobile service component"); + } + } + + protected void unsetDataSourceService(DataSourceService dataSourceService) { + //do nothing + } } diff --git a/pom.xml b/pom.xml index bf1b5a422c7..01585a93aeb 100644 --- a/pom.xml +++ b/pom.xml @@ -574,6 +574,12 @@ ${carbon.commons.version} + + org.wso2.carbon + org.wso2.carbon.ndatasource.core + ${carbon.kernel.version} + + org.wso2.carbon.apimgt