Merge pull request #527 from ayyoob/release-2.0.x

moved adapter configs as global configurations and few changes after testing
revert-70aa11f8
Rasika Perera 8 years ago committed by GitHub
commit 42ff976a41

@ -70,6 +70,10 @@
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.application.deployer</artifactId> <artifactId>org.wso2.carbon.application.deployer</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.ndatasource.core</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -116,7 +120,8 @@
javax.xml.namespace, javax.xml.namespace,
org.apache.commons.io, org.apache.commons.io,
org.wso2.carbon.application.deployer.*, org.wso2.carbon.application.deployer.*,
org.apache.axis2.engine org.apache.axis2.engine,
org.wso2.carbon.ndatasource.core,
</Import-Package> </Import-Package>
<Axis2Deployer>DeviceTypeDeployer</Axis2Deployer> <Axis2Deployer>DeviceTypeDeployer</Axis2Deployer>
<!--<WSO2-Application-Deployer>Device Type Capp Deployer</WSO2-Application-Deployer>--> <!--<WSO2-Application-Deployer>Device Type Capp Deployer</WSO2-Application-Deployer>-->

@ -23,6 +23,7 @@ import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext; import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.application.deployer.handler.AppDeploymentHandler; import org.wso2.carbon.application.deployer.handler.AppDeploymentHandler;
import org.wso2.carbon.device.mgt.extensions.device.type.deployer.DeviceTypeCAppDeployer; 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.registry.core.service.RegistryService;
import org.wso2.carbon.utils.ConfigurationContextService; import org.wso2.carbon.utils.ConfigurationContextService;
@ -38,6 +39,12 @@ import org.wso2.carbon.utils.ConfigurationContextService;
* @scr.reference name="registry.service" * @scr.reference name="registry.service"
* interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="0..1" * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="0..1"
* policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService" * 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 { public class DeviceTypeManagementServiceComponent {
@ -83,4 +90,16 @@ public class DeviceTypeManagementServiceComponent {
protected void unsetRegistryService(RegistryService registryService) { protected void unsetRegistryService(RegistryService registryService) {
DeviceTypeManagementDataHolder.getInstance().setRegistryService(null); 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
}
} }

@ -71,10 +71,10 @@
<FileBasedProperties>true</FileBasedProperties> <FileBasedProperties>true</FileBasedProperties>
<!--if file based properties is set to false then the configuration will be picked from platform configuration--> <!--if file based properties is set to false then the configuration will be picked from platform configuration-->
<ConfigProperties> <ConfigProperties>
<Property Name="mqtt.adapter.name">sample.mqtt.adapter</Property> <Property Name="mqttAdapterName">sample.mqtt.adapter</Property>
<Property Name="url">tcp://localhost:1883</Property> <Property Name="url">tcp://localhost:1883</Property>
<Property Name="username">admin</Property> <Property Name="username">admin</Property>
<Property Name="dcrUrl">https://localhost:9443/dynamic-client-web/register</Property> <Property Name="password">admin</Property>
<Property Name="qos">0</Property> <Property Name="qos">0</Property>
<Property Name="scopes"/> <Property Name="scopes"/>
<Property Name="clearSession">true</Property> <Property Name="clearSession">true</Property>

@ -50,12 +50,14 @@ public class MQTTNotificationStrategy implements NotificationStrategy {
adapterConfig.setMessageFormat(MessageType.TEXT); adapterConfig.setMessageFormat(MessageType.TEXT);
Map<String, String> configProperties = new HashMap<String, String>(); Map<String, String> configProperties = new HashMap<String, String>();
configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_BROKER_URL, String brokerUrl = config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_BROKER_URL);
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, configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_USERNAME,
config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_USERNAME)); config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_USERNAME));
configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_DCR_URL, configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_PASSWORD,
config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_DCR_URL)); config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_PASSWORD));
configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_CLEAR_SESSION, configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_CLEAR_SESSION,
config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_CLEAR_SESSION)); config.getProperty(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_CLEAR_SESSION));
configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_SCOPES, configProperties.put(MQTTAdapterConstants.MQTT_ADAPTER_PROPERTY_SCOPES,

@ -27,10 +27,10 @@ public final class MQTTAdapterConstants {
public static final String MQTT_ADAPTER_TYPE = "oauth-mqtt"; 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_BROKER_URL = "url";
public static final String MQTT_ADAPTER_PROPERTY_USERNAME = "username"; 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_SCOPES = "scopes";
public static final String MQTT_ADAPTER_PROPERTY_CLEAR_SESSION = "cleanSession"; 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_MESSAGE_QOS = "qos";
public static final String MQTT_ADAPTER_PROPERTY_NAME = "mqtt.adapter.name"; public static final String MQTT_ADAPTER_PROPERTY_NAME = "mqttAdapterName";
} }

@ -46,10 +46,6 @@
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.registry.core</artifactId> <artifactId>org.wso2.carbon.registry.core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.ws.commons.axiom.wso2</groupId> <groupId>org.apache.ws.commons.axiom.wso2</groupId>
<artifactId>axiom</artifactId> <artifactId>axiom</artifactId>

Loading…
Cancel
Save