|
@@ -81,9 +81,9 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
81
|
81
|
* Standard identities are inserted with a {@code null} key, custom identities use their
|
82
|
82
|
* custom type as the key.
|
83
|
83
|
*/
|
84
|
|
- private final Multimap<String, ConfigProvider> identities = ArrayListMultimap.create();
|
|
84
|
+ private final Multimap<String, ConfigFileBackedConfigProvider> identities = ArrayListMultimap.create();
|
85
|
85
|
/** Map of paths to corresponding config providers, to facilitate reloading. */
|
86
|
|
- private final Map<Path, ConfigProvider> configProvidersByPath = new ConcurrentHashMap<>();
|
|
86
|
+ private final Map<Path, ConfigFileBackedConfigProvider> configProvidersByPath = new ConcurrentHashMap<>();
|
87
|
87
|
/**
|
88
|
88
|
* The {@link ConfigProviderListener}s that have registered with this manager.
|
89
|
89
|
*
|
|
@@ -95,11 +95,11 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
95
|
95
|
/** Client info objecty. */
|
96
|
96
|
private final ClientInfo clientInfo;
|
97
|
97
|
/** The identity file used for the global config. */
|
98
|
|
- private ConfigProvider config;
|
|
98
|
+ private ConfigFileBackedConfigProvider config;
|
99
|
99
|
/** The identity file used for addon defaults. */
|
100
|
|
- private ConfigProvider addonConfig;
|
|
100
|
+ private ConfigFileBackedConfigProvider addonConfig;
|
101
|
101
|
/** The identity file bundled with the client containing version info. */
|
102
|
|
- private ConfigProvider versionConfig;
|
|
102
|
+ private ConfigFileBackedConfigProvider versionConfig;
|
103
|
103
|
/** The config manager used for global settings. */
|
104
|
104
|
private AggregateConfigProvider globalconfig;
|
105
|
105
|
|
|
@@ -251,7 +251,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
251
|
251
|
}
|
252
|
252
|
|
253
|
253
|
try {
|
254
|
|
- final ConfigProvider provider = new ConfigFileBackedConfigProvider(this, file, false);
|
|
254
|
+ final ConfigFileBackedConfigProvider provider = new ConfigFileBackedConfigProvider(this, file, false);
|
255
|
255
|
addConfigProvider(provider);
|
256
|
256
|
configProvidersByPath.put(file, provider);
|
257
|
257
|
} catch (InvalidIdentityFileException ex) {
|
|
@@ -268,7 +268,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
268
|
268
|
*
|
269
|
269
|
* @since 0.6.4
|
270
|
270
|
*/
|
271
|
|
- private Iterable<ConfigProvider> getAllIdentities() {
|
|
271
|
+ private Iterable<ConfigFileBackedConfigProvider> getAllIdentities() {
|
272
|
272
|
return identities.values();
|
273
|
273
|
}
|
274
|
274
|
|
|
@@ -282,7 +282,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
282
|
282
|
*
|
283
|
283
|
* @since 0.6.4
|
284
|
284
|
*/
|
285
|
|
- private String getGroup(final ConfigProvider identity) {
|
|
285
|
+ private String getGroup(final ConfigFileBackedConfigProvider identity) {
|
286
|
286
|
return identity.getTarget().getType() == ConfigTarget.TYPE.CUSTOM
|
287
|
287
|
? identity.getTarget().getData() : null;
|
288
|
288
|
}
|
|
@@ -345,7 +345,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
345
|
345
|
}
|
346
|
346
|
|
347
|
347
|
@Override
|
348
|
|
- public void addConfigProvider(final ConfigProvider identity) {
|
|
348
|
+ public void addConfigProvider(final ConfigFileBackedConfigProvider identity) {
|
349
|
349
|
checkNotNull(identity);
|
350
|
350
|
|
351
|
351
|
final String target = getGroup(identity);
|
|
@@ -369,7 +369,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
369
|
369
|
}
|
370
|
370
|
|
371
|
371
|
@Override
|
372
|
|
- public void removeConfigProvider(final ConfigProvider identity) {
|
|
372
|
+ public void removeConfigProvider(final ConfigFileBackedConfigProvider identity) {
|
373
|
373
|
checkNotNull(identity);
|
374
|
374
|
|
375
|
375
|
final String group = getGroup(identity);
|
|
@@ -377,7 +377,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
377
|
377
|
checkArgument(identities.containsEntry(group, identity));
|
378
|
378
|
|
379
|
379
|
Path path = null;
|
380
|
|
- for (Map.Entry<Path, ConfigProvider> entry : configProvidersByPath.entrySet()) {
|
|
380
|
+ for (Map.Entry<Path, ConfigFileBackedConfigProvider> entry : configProvidersByPath.entrySet()) {
|
381
|
381
|
if (entry.getValue() == identity) {
|
382
|
382
|
path = entry.getKey();
|
383
|
383
|
}
|
|
@@ -436,8 +436,8 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
436
|
436
|
*
|
437
|
437
|
* @return A list of all matching config sources
|
438
|
438
|
*/
|
439
|
|
- List<ConfigProvider> getIdentitiesForManager(final ConfigManager manager) {
|
440
|
|
- final List<ConfigProvider> sources = new ArrayList<>();
|
|
439
|
+ List<ConfigFileBackedConfigProvider> getIdentitiesForManager(final ConfigManager manager) {
|
|
440
|
+ final List<ConfigFileBackedConfigProvider> sources = new ArrayList<>();
|
441
|
441
|
|
442
|
442
|
synchronized (identities) {
|
443
|
443
|
sources.addAll(identities.get(null).stream()
|
|
@@ -476,7 +476,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
476
|
476
|
final String myTarget = (channel + '@' + network).toLowerCase();
|
477
|
477
|
|
478
|
478
|
synchronized (identities) {
|
479
|
|
- for (ConfigProvider identity : identities.get(null)) {
|
|
479
|
+ for (ConfigFileBackedConfigProvider identity : identities.get(null)) {
|
480
|
480
|
if (identity.getTarget().getType() == ConfigTarget.TYPE.CHANNEL
|
481
|
481
|
&& identity.getTarget().getData().equalsIgnoreCase(myTarget)) {
|
482
|
482
|
return identity;
|
|
@@ -501,7 +501,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
501
|
501
|
final String myTarget = network.toLowerCase();
|
502
|
502
|
|
503
|
503
|
synchronized (identities) {
|
504
|
|
- for (ConfigProvider identity : identities.get(null)) {
|
|
504
|
+ for (ConfigFileBackedConfigProvider identity : identities.get(null)) {
|
505
|
505
|
if (identity.getTarget().getType() == ConfigTarget.TYPE.NETWORK
|
506
|
506
|
&& identity.getTarget().getData().equalsIgnoreCase(myTarget)) {
|
507
|
507
|
return identity;
|
|
@@ -526,7 +526,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
526
|
526
|
final String myTarget = server.toLowerCase();
|
527
|
527
|
|
528
|
528
|
synchronized (identities) {
|
529
|
|
- for (ConfigProvider identity : identities.get(null)) {
|
|
529
|
+ for (ConfigFileBackedConfigProvider identity : identities.get(null)) {
|
530
|
530
|
if (identity.getTarget().getType() == ConfigTarget.TYPE.SERVER
|
531
|
531
|
&& identity.getTarget().getData().equalsIgnoreCase(myTarget)) {
|
532
|
532
|
return identity;
|
|
@@ -643,9 +643,9 @@ public class IdentityManager implements IdentityFactory, IdentityController {
|
643
|
643
|
* @param configManager The manager to be initialised.
|
644
|
644
|
*/
|
645
|
645
|
private void setUpConfigManager(final ConfigManager configManager) {
|
646
|
|
- final List<ConfigProvider> sources = getIdentitiesForManager(configManager);
|
|
646
|
+ final List<ConfigFileBackedConfigProvider> sources = getIdentitiesForManager(configManager);
|
647
|
647
|
|
648
|
|
- for (ConfigProvider identity : sources) {
|
|
648
|
+ for (ConfigFileBackedConfigProvider identity : sources) {
|
649
|
649
|
LOG.trace("Found {}", identity);
|
650
|
650
|
configManager.checkIdentity(identity);
|
651
|
651
|
}
|