|
48 | 48 | import com.arpnetworking.clusteraggregator.http.Routes;
|
49 | 49 | import com.arpnetworking.clusteraggregator.partitioning.DatabasePartitionSet;
|
50 | 50 | import com.arpnetworking.commons.builder.Builder;
|
| 51 | +import com.arpnetworking.commons.jackson.databind.ObjectMapperFactory; |
51 | 52 | import com.arpnetworking.configuration.jackson.DynamicConfiguration;
|
52 | 53 | import com.arpnetworking.configuration.jackson.HoconFileSource;
|
53 | 54 | import com.arpnetworking.configuration.jackson.JsonNodeFileSource;
|
|
65 | 66 | import com.arpnetworking.utility.partitioning.PartitionSet;
|
66 | 67 | import com.fasterxml.jackson.databind.ObjectMapper;
|
67 | 68 | import com.google.common.base.Optional;
|
| 69 | +import com.google.common.base.Throwables; |
68 | 70 | import com.google.inject.AbstractModule;
|
69 | 71 | import com.google.inject.Injector;
|
70 | 72 | import com.google.inject.Provides;
|
|
73 | 75 | import com.google.inject.name.Names;
|
74 | 76 | import com.typesafe.config.Config;
|
75 | 77 | import com.typesafe.config.ConfigFactory;
|
| 78 | +import com.typesafe.config.ConfigParseOptions; |
| 79 | +import com.typesafe.config.ConfigSyntax; |
76 | 80 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
77 | 81 |
|
78 | 82 | import java.io.File;
|
| 83 | +import java.io.IOException; |
79 | 84 | import java.util.Collections;
|
80 | 85 | import java.util.Locale;
|
81 | 86 | import java.util.Map;
|
@@ -117,7 +122,19 @@ protected void configure() {
|
117 | 122 | @Named("akka-config")
|
118 | 123 | @SuppressFBWarnings("UPM_UNCALLED_PRIVATE_METHOD") // Invoked reflectively by Guice
|
119 | 124 | private Config provideAkkaConfig() {
|
120 |
| - return ConfigFactory.parseMap(_configuration.getAkkaConfiguration(), _configuration.toString()); |
| 125 | + // This is necessary because the keys contain periods which when |
| 126 | + // transforming from a map are considered compound path elements. By |
| 127 | + // rendering to JSON and then parsing it this forces the keys to be |
| 128 | + // quoted and thus considered single path elements even with periods. |
| 129 | + try { |
| 130 | + final String akkaJsonConfig = OBJECT_MAPPER.writeValueAsString(_configuration.getAkkaConfiguration()); |
| 131 | + return ConfigFactory.parseString( |
| 132 | + akkaJsonConfig, |
| 133 | + ConfigParseOptions.defaults() |
| 134 | + .setSyntax(ConfigSyntax.JSON)); |
| 135 | + } catch (final IOException e) { |
| 136 | + throw Throwables.propagate(e); |
| 137 | + } |
121 | 138 | }
|
122 | 139 |
|
123 | 140 | @Provides
|
@@ -362,10 +379,10 @@ private PartitionSet provideDatabasePartitionSet(@Named("metrics_clusteragg") fi
|
362 | 379 | return new DatabasePartitionSet(database, partitionSet);
|
363 | 380 | }
|
364 | 381 |
|
365 |
| - |
366 | 382 | private final ClusterAggregatorConfiguration _configuration;
|
367 | 383 |
|
368 | 384 | private static final String HOCON_FILE_EXTENSION = ".hocon";
|
| 385 | + private static final ObjectMapper OBJECT_MAPPER = ObjectMapperFactory.getInstance(); |
369 | 386 |
|
370 | 387 | private static final class RoundRobinEmitterFactory implements ConfiguredLaunchableFactory<Props, EmitterConfiguration> {
|
371 | 388 |
|
|
0 commit comments