blob: 9784640485217ce5f8ea3cea5267e33f33dcf8eb (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude;
import com.yahoo.config.subscription.ConfigGetter;
import com.yahoo.config.ConfigInstance;
import com.yahoo.search.config.IndexInfoConfig;
import com.yahoo.container.QrSearchersConfig;
/**
* @author Simon Thoresen Hult
*/
public abstract class IndexFactsFactory {
public static IndexFacts newInstance(String configId) {
return new IndexFacts(new IndexModel(resolveConfig(IndexInfoConfig.class, configId),
resolveConfig(QrSearchersConfig.class, configId)));
}
public static IndexFacts newInstance(String indexInfoConfigId, String qrSearchersConfigId) {
return new IndexFacts(new IndexModel(resolveConfig(IndexInfoConfig.class, indexInfoConfigId),
resolveConfig(QrSearchersConfig.class, qrSearchersConfigId)));
}
@SuppressWarnings("deprecation")
private static <T extends ConfigInstance> T resolveConfig(Class<T> configClass, String configId) {
if (configId == null) return null;
return ConfigGetter.getConfig(configClass, configId);
}
}
|