From ea316372231a7843396e8ae11d36cbf85780c00e Mon Sep 17 00:00:00 2001 From: ayyoob Date: Sun, 8 Jan 2017 01:19:03 +0530 Subject: [PATCH] added scr reference to datasource for deployer and few fixes after the changes in the plugin --- .../pom.xml | 7 ++++++- .../DeviceTypeManagementServiceComponent.java | 19 +++++++++++++++++++ .../src/test/resources/sample.xml | 4 ++-- .../mqtt/MQTTNotificationStrategy.java | 10 ++++++---- .../internal/util/MQTTAdapterConstants.java | 4 ++-- .../pom.xml | 4 ---- 6 files changed, 35 insertions(+), 13 deletions(-) diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index 7a12b14cca0..0cf5464ad79 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -70,6 +70,10 @@ org.wso2.carbon org.wso2.carbon.application.deployer + + org.wso2.carbon + org.wso2.carbon.ndatasource.core + @@ -116,7 +120,8 @@ javax.xml.namespace, org.apache.commons.io, org.wso2.carbon.application.deployer.*, - org.apache.axis2.engine + org.apache.axis2.engine, + org.wso2.carbon.ndatasource.core, DeviceTypeDeployer diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/internal/DeviceTypeManagementServiceComponent.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/internal/DeviceTypeManagementServiceComponent.java index 05679c0a5cb..9c7d771c11d 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/internal/DeviceTypeManagementServiceComponent.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/internal/DeviceTypeManagementServiceComponent.java @@ -23,6 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; import org.wso2.carbon.application.deployer.handler.AppDeploymentHandler; import org.wso2.carbon.device.mgt.extensions.device.type.deployer.DeviceTypeCAppDeployer; +import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.utils.ConfigurationContextService; @@ -38,6 +39,12 @@ import org.wso2.carbon.utils.ConfigurationContextService; * @scr.reference name="registry.service" * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="0..1" * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService" + * @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 DeviceTypeManagementServiceComponent { @@ -83,4 +90,16 @@ public class DeviceTypeManagementServiceComponent { protected void unsetRegistryService(RegistryService registryService) { DeviceTypeManagementDataHolder.getInstance().setRegistryService(null); } + + 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 android mobile service component"); + } + } + + protected void unsetDataSourceService(DataSourceService dataSourceService) { + //do nothing + } } diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml index 26a911db1ff..aa18e5d03b7 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml @@ -71,10 +71,10 @@ true - sample.mqtt.adapter + sample.mqtt.adapter tcp://localhost:1883 admin - https://localhost:9443/dynamic-client-web/register + admin 0 true diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java index 1f707aafa5f..03f2d8f9d3c 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java @@ -50,12 +50,14 @@ public class MQTTNotificationStrategy implements NotificationStrategy { adapterConfig.setMessageFormat(MessageType.TEXT); Map configProperties = new HashMap(); - configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_BROKER_URL, - config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_BROKER_URL)); + String brokerUrl = config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_BROKER_URL); + if (brokerUrl != null && !brokerUrl.isEmpty()) { + configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_BROKER_URL, brokerUrl); + } configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_USERNAME, config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_USERNAME)); - configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_DCR_URL, - config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_DCR_URL)); + configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_PASSWORD, + config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_PASSWORD)); configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_CLEAR_SESSION, config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_CLEAR_SESSION)); configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_SCOPES, diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/internal/util/MQTTAdapterConstants.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/internal/util/MQTTAdapterConstants.java index 60005764be2..9dfaf1c87b7 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/internal/util/MQTTAdapterConstants.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/mqtt/internal/util/MQTTAdapterConstants.java @@ -27,10 +27,10 @@ public final class MQTTAdapterConstants { public static final String MQTT_ADAPTER_TYPE = "oauth-mqtt"; public static final String MQTT_ADAPTER_PROPERTY_BROKER_URL = "url"; public static final String MQTT_ADAPTER_PROPERTY_USERNAME = "username"; - public static final String MQTT_ADAPTER_PROPERTY_DCR_URL = "dcrUrl"; + public static final String MQTT_ADAPTER_PROPERTY_PASSWORD = "password"; public static final String MQTT_ADAPTER_PROPERTY_SCOPES = "scopes"; public static final String MQTT_ADAPTER_PROPERTY_CLEAR_SESSION = "cleanSession"; public static final String MQTT_ADAPTER_PROPERTY_MESSAGE_QOS = "qos"; - public static final String MQTT_ADAPTER_PROPERTY_NAME = "mqtt.adapter.name"; + public static final String MQTT_ADAPTER_PROPERTY_NAME = "mqttAdapterName"; } diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml index e706f0855df..4ad161c802d 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml @@ -46,10 +46,6 @@ org.wso2.carbon org.wso2.carbon.registry.core - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common - org.apache.ws.commons.axiom.wso2 axiom