|
2 | 2 |
|
3 | 3 | import java.util.ArrayList; |
4 | 4 | import java.util.Arrays; |
| 5 | +import java.util.HashMap; |
5 | 6 | import java.util.List; |
6 | 7 | import java.util.Map; |
7 | | -import java.util.Spliterator; |
8 | | -import java.util.Spliterators; |
9 | 8 | import java.util.regex.Matcher; |
10 | 9 | import java.util.regex.Pattern; |
11 | 10 | import java.util.stream.Collectors; |
12 | | -import java.util.stream.StreamSupport; |
13 | 11 |
|
| 12 | +import org.apache.commons.configuration2.PropertiesConfiguration; |
14 | 13 | import org.apache.commons.lang3.StringUtils; |
15 | 14 |
|
16 | 15 | import root.core.domain.JdbcConnectionInfo; |
@@ -126,13 +125,20 @@ private List<MonitoringYN> getMonitoringYNList(List<String> aliasList, List<Moni |
126 | 125 |
|
127 | 126 | @Override |
128 | 127 | public Map<String, String> getMonitoringPresetMap() { |
129 | | - return StreamSupport |
130 | | - .stream(Spliterators.spliteratorUnknownSize(propRepo.getConfiguration("connInfoConfig").getKeys(), |
131 | | - Spliterator.ORDERED), false) |
132 | | - .filter(key -> key.matches(MONITORING_PRESET_KEY)).collect(Collectors.toUnmodifiableMap(key -> { |
133 | | - Matcher m = MONITORING_PRESET_KEY_PATTERN.matcher(key); |
134 | | - return m.matches() ? m.group(1) : ""; |
135 | | - }, key -> propRepo.getMonitoringConfigResource(key))); |
| 128 | + Map<String, String> result = new HashMap<>(); |
| 129 | + |
| 130 | + PropertiesConfiguration config = propRepo.getConfiguration("connInfoConfig"); |
| 131 | + |
| 132 | + config.getKeys().forEachRemaining(key -> { |
| 133 | + if (key.matches(MONITORING_PRESET_KEY)) { |
| 134 | + Matcher m = MONITORING_PRESET_KEY_PATTERN.matcher(key); |
| 135 | + if (m.matches()) { |
| 136 | + String presetName = m.group(1); |
| 137 | + result.put(presetName, config.getString(key)); |
| 138 | + } |
| 139 | + } |
| 140 | + }); |
| 141 | + return result; |
136 | 142 | } |
137 | 143 |
|
138 | 144 | @Override |
|
0 commit comments