1
|
package eu.dnetlib.functionality.index.client;
|
2
|
|
3
|
import java.util.List;
|
4
|
|
5
|
import javax.annotation.Resource;
|
6
|
|
7
|
/**
|
8
|
* The Class GlobalIndexClientFactory.
|
9
|
*/
|
10
|
|
11
|
/**
|
12
|
* The Class ResolvingIndexClientFactory.
|
13
|
*/
|
14
|
public class ResolvingIndexClientFactory {
|
15
|
|
16
|
/** The index client factories. */
|
17
|
@Resource
|
18
|
private List<IndexClientFactory> indexClientFactories;
|
19
|
|
20
|
/**
|
21
|
* Gets the client.
|
22
|
*
|
23
|
* @param format
|
24
|
* the format
|
25
|
* @param layout
|
26
|
* the layout
|
27
|
* @param interpretation
|
28
|
* the interpretation
|
29
|
* @param backendId
|
30
|
* the backend id
|
31
|
* @return the client
|
32
|
* @throws IndexClientException
|
33
|
* the index client exception
|
34
|
*/
|
35
|
public IndexClient getClient(final String format, final String layout, final String interpretation, final String backendId) throws IndexClientException {
|
36
|
for (IndexClientFactory factory : indexClientFactories) {
|
37
|
if (factory.getBackendId().equalsIgnoreCase(backendId)) { return factory.getClient(format, layout, interpretation); }
|
38
|
}
|
39
|
throw new IndexClientException("No client for bakendId: " + backendId);
|
40
|
}
|
41
|
|
42
|
}
|