Conversation
| @@ -0,0 +1,233 @@ | |||
| /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |||
| * Copyright (c) 2019 SAP SE or an affiliate company. All rights reserved. | |||
There was a problem hiding this comment.
The date is invalid (2019).
By the way, should we add the copyright to all files?
|
|
||
| public class ConfigurationHandler { | ||
| private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationHandler.class); // logger | ||
| private static final String BASE_PATH = "./../edgeservices/"; // base path for custom configuration, same of other |
There was a problem hiding this comment.
"same of other" is unclear to me what you mean.
| private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationHandler.class); // logger | ||
| private static final String BASE_PATH = "./../edgeservices/"; // base path for custom configuration, same of other | ||
| // services | ||
| private static final String UNIFORM_PATH_SEPARATOR = "/"; // linux/windows valid file separator |
There was a problem hiding this comment.
Why not using the already generic File.separator constant?
https://docs.oracle.com/javase/7/docs/api/java/io/File.html#separator
| defaultConfiguration = loadDefaultConfiguration(); | ||
| } | ||
| // existing file paths | ||
| String jsonFile = BASE_PATH + serviceName + "/" + serviceName + ".json"; |
There was a problem hiding this comment.
use File.separator, or reuse the constant you have defined at the top of the file.
| } | ||
| // existing file paths | ||
| String jsonFile = BASE_PATH + serviceName + "/" + serviceName + ".json"; | ||
| String fingerprintFile = BASE_PATH + serviceName + "/" + serviceName + "_fingerprint.txt"; |
There was a problem hiding this comment.
use File.separator, or reuse the constant you have defined at the top of the file.
| Float variance; | ||
| Float pressureScale; | ||
| Boolean ingestionEnabled; | ||
| Boolean filterMeasurements; | ||
| Boolean filterCalculation; | ||
| List<MessageFilter> filteredObjects; |
| String externalConfigurationTopic; | ||
| String configurationFile; |
| String capabilityAlternateId; | ||
| String sensorAlternateId; | ||
| String sensorTypeAlternateId; |
| TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() { | ||
| }; | ||
| Map<String, Object> originalMassageMap = mapper.readValue(mqttMessage.toString(), typeRef); |
There was a problem hiding this comment.
Better:
Map<String, Object > originalMassageMap = mapper.readValue(
mqttMessage.toString(), TypeFactory.mapType(HashMap.class, String.class, Object.class));
| } | ||
|
|
||
| public static void sendMessage(String topic, String content) { | ||
| MqttMessage message = null; |
There was a problem hiding this comment.
= null is redundant here, you can remove it.
Signed-off-by: Marco Porru <marco.porru@sap.com>
No description provided.