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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.federation.http;
import com.yahoo.component.ComponentId;
import com.yahoo.search.federation.ProviderConfig;
import com.yahoo.search.cache.QrBinaryCacheConfig;
import com.yahoo.search.cache.QrBinaryCacheRegionConfig;
import com.yahoo.search.Result;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.statistics.Statistics;
import java.util.Collections;
/**
* Superclass for http provider searchers which depends on config. All this is doing is translating
* the provider and cache configurations to parameters which are passed upwards.
*
* @author <a href="mailto:arnebef@yahoo-inc.com">Arne Bergene Fossaa</a>
* @author bratseth
*/
public abstract class ConfiguredHTTPProviderSearcher extends HTTPProviderSearcher {
/** Create this from a configuraton */
public ConfiguredHTTPProviderSearcher(final ComponentId id, final ProviderConfig providerConfig, Statistics manager) {
super(id,ConfiguredSearcherHelper.toConnectionList(providerConfig),new HTTPParameters(providerConfig), manager);
}
/** Create this from a configuraton */
public ConfiguredHTTPProviderSearcher(final ComponentId id, final ProviderConfig providerConfig,
HTTPParameters parameters, Statistics manager) {
super(id,ConfiguredSearcherHelper.toConnectionList(providerConfig),parameters, manager);
}
/** Create this from a configuraton with a configured cache */
public ConfiguredHTTPProviderSearcher(final ComponentId id, final ProviderConfig providerConfig,
final QrBinaryCacheConfig cacheConfig,
final QrBinaryCacheRegionConfig regionConfig, Statistics manager) {
super(id,ConfiguredSearcherHelper.toConnectionList(providerConfig),new HTTPParameters(providerConfig), manager);
configureCache(cacheConfig,regionConfig);
}
/** Create this from a configuraton with a configured cache */
public ConfiguredHTTPProviderSearcher(final ComponentId id, final ProviderConfig providerConfig,
final QrBinaryCacheConfig cacheConfig,
final QrBinaryCacheRegionConfig regionConfig, HTTPParameters parameters, Statistics manager) {
super(id,ConfiguredSearcherHelper.toConnectionList(providerConfig),parameters, manager);
configureCache(cacheConfig,regionConfig);
}
/** Create an instance from direct parameters having a single connection. Useful for testing */
public ConfiguredHTTPProviderSearcher(String idString,String host,int port,String path, Statistics manager) {
super(new ComponentId(idString), Collections.singletonList(new Connection(host,port)),path, manager);
}
/** Create an instance from direct parameters having a single connection. Useful for testing */
public ConfiguredHTTPProviderSearcher(String idString,String host,int port,HTTPParameters parameters, Statistics manager) {
super(new ComponentId(idString), Collections.singletonList(new Connection(host,port)),parameters, manager);
}
/**
* Override this to provider multi-phase result filling towards a backend.
* This default implementation does nothing.
*/
@Override
public void fill(Result result,String summaryName, Execution execution,Connection connection) {
}
}
|