From f7dbc156b3fe6f819fa80a3de74b4d4a9759d862 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Mon, 1 May 2017 19:15:11 +0530 Subject: [PATCH] #665 : Added some changes to reuse PropertyUtils.replaceTenantDomainProperty() --- .../device/mgt/input/adapter/mqtt/MQTTEventAdapter.java | 4 ---- .../mgt/input/adapter/mqtt/util/MQTTAdapterListener.java | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java index af5cb0c283..f390cf3fc2 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java @@ -57,10 +57,6 @@ public class MQTTEventAdapter implements InputEventAdapter { ,globalProperties); String topic = eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC); String tenantDomain = topic.split("/")[0]; - if (tenantDomain.equals("${tenant-domain}")) { - tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - topic = topic.replaceAll("\\$\\{tenant-domain\\}", tenantDomain); - } mqttAdapterListener = new MQTTAdapterListener(mqttBrokerConnectionConfiguration ,topic ,eventAdapterConfiguration diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java index 182b5c9a06..f9d62482e9 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java @@ -88,7 +88,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { int keepAlive = mqttBrokerConnectionConfiguration.getKeepAlive(); this.topic = PropertyUtils.replaceTenantDomainProperty(topic); this.eventAdapterListener = inputEventAdapterListener; - this.tenantDomain = tenantDomain; + this.tenantDomain = PropertyUtils.replaceTenantDomainProperty(tenantDomain); //SORTING messages until the server fetches them String temp_directory = System.getProperty("java.io.tmpdir");