From 9a1ffa6ab78bf13ee5929e1873e50862cf7b336c Mon Sep 17 00:00:00 2001 From: manoj Date: Fri, 27 Mar 2015 00:11:21 +0530 Subject: [PATCH] Add listner to Data source service --- .../org.wso2.carbon.device.mgt.core/pom.xml | 7 ++++++- .../DeviceManagementServiceComponent.java | 18 ++++++++++++++++++ pom.xml | 6 ++++++ 3 files changed, 30 insertions(+), 1 deletion(-) 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 e66aebc504..4771053b49 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 2cc370a15c..3fe93d1fb4 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 bf1b5a422c..01585a93ae 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