blob: 3831c12ae3f5cab66acdc5936135f8a3899d8b01 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server;
import com.yahoo.component.annotation.Inject;
import com.yahoo.config.model.api.ConfigDefinitionRepo;
import com.yahoo.vespa.config.ConfigDefinitionKey;
import com.yahoo.vespa.config.buildergen.ConfigDefinition;
import java.util.Collections;
import java.util.Map;
/**
* A global pool of all config definitions that this server knows about. These objects can be shared
* by all tenants, as they are not modified.
*
* @author Ulf Lilleengen
*/
public class StaticConfigDefinitionRepo implements ConfigDefinitionRepo {
private final ConfigDefinitionRepo repo;
// Only useful in tests that don't need full blown repo.
public StaticConfigDefinitionRepo() {
this.repo = new ConfigDefinitionRepo() {
@Override
public Map<ConfigDefinitionKey, ConfigDefinition> getConfigDefinitions() {
return Collections.emptyMap();
}
@Override
public ConfigDefinition get(ConfigDefinitionKey key) {
return null;
}
};
}
@SuppressWarnings("unused")
@Inject
public StaticConfigDefinitionRepo(ConfigServerDB serverDB) {
this.repo = new com.yahoo.config.model.application.provider.StaticConfigDefinitionRepo(serverDB.serverdefs());
}
@Override
public Map<ConfigDefinitionKey, ConfigDefinition> getConfigDefinitions() {
return repo.getConfigDefinitions();
}
@Override
public ConfigDefinition get(ConfigDefinitionKey key) { return repo.get(key); }
}
|