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