Project

General

Profile

« Previous | Next » 

Revision 57157

Added by Enrico Ottonello over 4 years ago

solr 772 integration

View differences:

SolrIndexClientFactory.java
3 3
import java.lang.reflect.Type;
4 4
import java.util.Map;
5 5

  
6
import org.springframework.beans.factory.annotation.Autowired;
7
import org.springframework.beans.factory.annotation.Required;
8

  
6 9
import com.google.common.reflect.TypeToken;
7 10
import com.google.gson.Gson;
11

  
8 12
import eu.dnetlib.clients.index.client.AbstractIndexClientFactory;
9 13
import eu.dnetlib.clients.index.client.IndexClient;
10 14
import eu.dnetlib.clients.index.client.IndexClientException;
......
12 16
import eu.dnetlib.index.query.SolrIndexQueryFactory;
13 17
import eu.dnetlib.index.query.SolrIndexQueryResponseFactory;
14 18
import eu.dnetlib.index.solr.cql.SolrTypeBasedCqlValueTransformerMapFactory;
15
import org.springframework.beans.factory.annotation.Autowired;
16
import org.springframework.beans.factory.annotation.Required;
19
import eu.dnetlib.utils.MetadataReference;
20
import eu.dnetlib.utils.MetadataReferenceFactory;
17 21

  
18 22
/**
19 23
 * The Class SolrIndexClientFactory.
20 24
 */
21 25
public class SolrIndexClientFactory extends AbstractIndexClientFactory implements IndexClientFactory {
22 26

  
23
	/**
24
	 * The id.
25
	 */
27
	/** The id. */
26 28
	private static String ID = "id";
27
	/**
28
	 * The type token.
29
	 */
30
	@SuppressWarnings("serial")
31
	protected Type typeToken = new TypeToken<Map<String, String>>() {
32
	}.getType();
33
	/**
34
	 * The configuration.
35
	 */
29

  
30
	/** The configuration. */
36 31
	private String configuration;
37
	/**
38
	 * The service properties.
39
	 */
32

  
33
	/** The type token. */
34
	protected Type typeToken = new TypeToken<Map<String, String>>() {}.getType();
35

  
36
	/** The service properties. */
40 37
	private Map<String, String> serviceProperties;
41 38

  
42 39
	@Autowired
......
51 48
	/**
52 49
	 * Inits the class.
53 50
	 *
54
	 * @throws IndexClientException the index client exception
51
	 * @throws IndexClientException
52
	 *             the index client exception
55 53
	 */
56 54
	@Override
57 55
	public void init() throws IndexClientException {
......
64 62

  
65 63
	/**
66 64
	 * {@inheritDoc}
65
	 *
66
	 * @see IndexClientFactory#getBackendId()
67 67
	 */
68 68
	@Override
69 69
	public String getBackendId() {
......
74 74
	 * {@inheritDoc}
75 75
	 *
76 76
	 * @throws IndexClientException
77
	 *
78
	 * @see IndexClientFactory#getClient(String, String, String)
77 79
	 */
78 80
	@Override
79 81
	public IndexClient getClient(final String format, final String layout, final String interpretation) throws IndexClientException {
......
82 84
	}
83 85

  
84 86
	/**
87
	 * {@inheritDoc}
88
	 *
89
	 * @throws IndexClientException
90
	 *
91
	 * @see IndexClientFactory#getClient(MetadataReference)
92
	 */
93
	@Override
94
	public IndexClient getClient(final MetadataReference mdRef) throws IndexClientException {
95
		return getClient(mdRef.getFormat(), mdRef.getLayout(), mdRef.getInterpretation());
96
	}
97

  
98
	@Override
99
	public IndexClient getClient(final String collection) throws IndexClientException {
100
		return getClient(MetadataReferenceFactory.decodeMetadata(collection));
101
	}
102

  
103
	/**
85 104
	 * Gets the configuration.
86 105
	 *
87 106
	 * @return the configuration
......
93 112
	/**
94 113
	 * Sets the configuration.
95 114
	 *
96
	 * @param configuration the configuration
115
	 * @param configuration
116
	 *            the configuration
97 117
	 */
98 118
	@Required
99 119
	public void setConfiguration(final String configuration) {

Also available in: Unified diff