+ // CONFIG MANAGEMENT
+ //
+
+ public Map<String, String> getConfig() throws IOException, FcpException {
+ Map<String, String> results = new HashMap<>();
+ new ExtendedFcpAdapter() {
+ @Override
+ public void run() throws IOException {
+ GetConfig getConfig = new GetConfig(createIdentifier("get-config"));
+ getConfig.setWithCurrent(true);
+ getConfig.setWithDefaults(true);
+ getConfig.setWithShortDescription(true);
+ getConfig.setWithLongDescription(true);
+ getConfig.setWithDataTypes(true);
+ getConfig.setWithExpertFlag(true);
+ getConfig.setWithForceWriteFlag(true);
+ getConfig.setWithSortOrder(true);
+ fcpConnection.sendMessage(getConfig);
+ }
+
+ @Override
+ public void receivedConfigData(FcpConnection fcpConnection, ConfigData configData) {
+ results.putAll(filterByResponseType(configData, "current"));
+ results.putAll(filterByResponseType(configData, "default"));
+ results.putAll(filterByResponseType(configData, "shortDescription"));
+ results.putAll(filterByResponseType(configData, "longDescription"));
+ results.putAll(filterByResponseType(configData, "expertFlag"));
+ results.putAll(filterByResponseType(configData, "dataType"));
+ results.putAll(filterByResponseType(configData, "sortOrder"));
+ results.putAll(filterByResponseType(configData, "forceWriteFlag"));
+ complete();
+ }
+
+ private Map<String, String> filterByResponseType(ConfigData configData, String responseType) {
+ return configData.getFields().entrySet().stream()
+ .filter(e -> e.getKey().startsWith(responseType + "."))
+ .collect(toMap(Entry::getKey, Entry::getValue));
+ }
+ }.execute();
+ return results;
+ }
+
+ //