From 67199866a077a80c1a8a0480e8152537e17afbe2 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Wed, 13 Jan 2016 17:30:38 +0530 Subject: [PATCH] skipped reading from configuration file --- .../device/mgt/iot/apimgt/ApisAppClient.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/apimgt/ApisAppClient.java b/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/apimgt/ApisAppClient.java index b1cc3ddb6a..0586fbd393 100644 --- a/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/apimgt/ApisAppClient.java +++ b/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/apimgt/ApisAppClient.java @@ -81,14 +81,19 @@ public class ApisAppClient { String consumerKeyAndSecret = deviceTypeToApiAppMap.get(deviceType); if(consumerKeyAndSecret == null){ ArrayList iotDeviceTypeConfigs = new ArrayList<>(); - IotDeviceTypeConfig DeviceTypeConfig = IotDeviceTypeConfigurationManager.getInstance().getIotDeviceTypeConfigMap().get(deviceType); - if(DeviceTypeConfig != null) { - iotDeviceTypeConfigs.add(DeviceTypeConfig); - setBase64EncodedConsumerKeyAndSecret(iotDeviceTypeConfigs); - consumerKeyAndSecret = deviceTypeToApiAppMap.get(deviceType); - if(consumerKeyAndSecret==null){ - log.warn("There is no API application for the device type " + deviceType); - } + IotDeviceTypeConfig deviceTypeConfig = IotDeviceTypeConfigurationManager.getInstance().getIotDeviceTypeConfigMap().get(deviceType); + if(deviceTypeConfig != null) { + iotDeviceTypeConfigs.add(deviceTypeConfig); + }else{ + deviceTypeConfig = new IotDeviceTypeConfig(); + deviceTypeConfig.setType(deviceType); + deviceTypeConfig.setApiApplicationName(deviceType); + iotDeviceTypeConfigs.add(deviceTypeConfig); + } + setBase64EncodedConsumerKeyAndSecret(iotDeviceTypeConfigs); + consumerKeyAndSecret = deviceTypeToApiAppMap.get(deviceType); + if(consumerKeyAndSecret==null){ + log.warn("There is no API application for the device type " + deviceType); } } return consumerKeyAndSecret; @@ -132,8 +137,6 @@ public class ApisAppClient { getMethod.setHeader("cookie", cookie); httpResponse = httpClient.execute(getMethod); response = IoTUtil.getResponseString(httpResponse); - - if(log.isDebugEnabled()) { log.debug(response); }