Project

General

Profile

« Previous | Next » 

Revision 28996

Added bean

View differences:

modules/dnet-index-solr-service/trunk/src/main/java/eu/dnetlib/functionality/index/SolrIndexServerDAO.java
18 18
import org.dom4j.io.SAXReader;
19 19
import org.springframework.beans.factory.annotation.Autowired;
20 20

  
21
import com.google.common.collect.BiMap;
22 21
import com.google.common.collect.Lists;
23 22
import com.google.common.collect.Maps;
24 23

  
......
29 28
import eu.dnetlib.functionality.index.utils.MetadataReference;
30 29
import eu.dnetlib.functionality.index.utils.ZkUtils;
31 30

  
31
// TODO: Auto-generated Javadoc
32
/**
33
 * The Class SolrIndexServerDAO.
34
 */
32 35
public class SolrIndexServerDAO extends AbstractBackendDescriptor implements IndexServerDAO {
33 36

  
34 37
	/**
......
36 39
	 */
37 40
	private static final Log log = LogFactory.getLog(SolrIndexServerDAO.class); // NOPMD by marko on 11/24/08 5:02 PM
38 41

  
42
	/** The server map. */
39 43
	private Map<MetadataReference, CloudSolrServer> serverMap = Maps.newHashMap();
40 44

  
45
	/** The http client. */
41 46
	private HttpClient httpClient;
42 47

  
48
	/** The zk utils. */
43 49
	@Autowired
44 50
	private ZkUtils zkUtils;
45 51

  
52
	/**
53
	 * {@inheritDoc}
54
	 * 
55
	 * @see eu.dnetlib.functionality.index.IndexServerDAO#createIndexCollection(eu.dnetlib.functionality.index.utils.MetadataReference,
56
	 *      java.lang.String)
57
	 */
46 58
	@Override
47 59
	public IndexCollection createIndexCollection(final MetadataReference mdref, final String fields) throws IndexServiceException {
48 60
		try {
......
76 88
		return null;
77 89
	}
78 90

  
91
	/**
92
	 * Parses the.
93
	 *
94
	 * @param fields
95
	 *            the fields
96
	 * @return the document
97
	 * @throws IndexServiceException
98
	 *             the index service exception
99
	 */
79 100
	private Document parse(final String fields) throws IndexServiceException {
80 101
		try {
81 102
			return new SAXReader().read(new StringReader(fields));
......
84 105
		}
85 106
	}
86 107

  
108
	/**
109
	 * {@inheritDoc}
110
	 * 
111
	 * @see eu.dnetlib.functionality.index.IndexServerDAO#getIndexCollection(eu.dnetlib.functionality.index.utils.MetadataReference)
112
	 */
87 113
	@Override
88 114
	public IndexCollection getIndexCollection(final MetadataReference mdref) throws IndexServiceException {
89 115
		// TODO Auto-generated method stub
90 116
		return null;
91 117
	}
92 118

  
119
	/**
120
	 * {@inheritDoc}
121
	 * 
122
	 * @see eu.dnetlib.functionality.index.IndexServerDAO#getSchema()
123
	 */
93 124
	@Override
94 125
	public Map<String, ValueType> getSchema() throws IndexServiceException {
95 126
		// TODO Auto-generated method stub
96 127
		return null;
97 128
	}
98 129

  
130
	/**
131
	 * {@inheritDoc}
132
	 * 
133
	 * @see eu.dnetlib.functionality.index.IndexServerDAO#getCqlValueTransformerMap()
134
	 */
99 135
	@Override
100 136
	public CqlValueTransformerMap getCqlValueTransformerMap() throws IndexServiceException {
101 137
		// TODO Auto-generated method stub
102 138
		return null;
103 139
	}
104 140

  
141
	/**
142
	 * {@inheritDoc}
143
	 * 
144
	 * @see eu.dnetlib.functionality.index.IndexServerDAO#getDocumentMapperFactory()
145
	 */
105 146
	@Override
106 147
	public DocumentMapperFactory getDocumentMapperFactory() throws IndexServiceException {
107 148
		// TODO Auto-generated method stub
108 149
		return null;
109 150
	}
110 151

  
152
	/**
153
	 * {@inheritDoc}
154
	 * 
155
	 * @see eu.dnetlib.functionality.index.IndexServerDAO#shutdown()
156
	 */
111 157
	@Override
112
	public BiMap<String, String> getBrowseAliases() throws IndexServiceException {
113
		// TODO Auto-generated method stub
114
		return null;
115
	}
116

  
117
	@Override
118
	public Map<String, String> getWeights() throws IndexServiceException {
119
		// TODO Auto-generated method stub
120
		return null;
121
	}
122

  
123
	@Override
124 158
	public void shutdown() throws IndexServiceException {
125 159
		// TODO Auto-generated method stub
126 160

  
127 161
	}
128 162

  
163
	/**
164
	 * Gets the server.
165
	 *
166
	 * @param mdRef
167
	 *            the md ref
168
	 * @return the server
169
	 * @throws IndexServiceException
170
	 *             the index service exception
171
	 */
129 172
	private CloudSolrServer getServer(final MetadataReference mdRef) throws IndexServiceException {
130 173
		try {
131 174
			if (!serverMap.containsKey(mdRef)) {
......
140 183
		}
141 184
	}
142 185

  
186
	/**
187
	 * Gets the http client.
188
	 *
189
	 * @return the http client
190
	 */
143 191
	public HttpClient getHttpClient() {
144 192
		return httpClient;
145 193
	}
146 194

  
195
	/**
196
	 * Sets the http client.
197
	 *
198
	 * @param httpClient
199
	 *            the http client
200
	 */
147 201
	public void setHttpClient(final HttpClient httpClient) {
148 202
		this.httpClient = httpClient;
149 203
	}
modules/dnet-index-solr-service/trunk/src/main/java/eu/dnetlib/functionality/index/SolrIndexCollection.java
15 15
import eu.dnetlib.functionality.index.utils.IndexFieldUtility;
16 16
import eu.dnetlib.functionality.index.utils.MetadataReference;
17 17

  
18
/**
19
 * The Class SolrIndexCollection.
20
 */
18 21
public class SolrIndexCollection implements IndexCollection {
19 22

  
20 23
	/**
......
22 25
	 */
23 26
	private static final Log log = LogFactory.getLog(SolrIndexCollection.class); // NOPMD by marko on 11/24/08 5:02 PM
24 27

  
28
	/** The Constant STATUS_OK. */
25 29
	public static final int STATUS_OK = 200;
26 30

  
31
	/** The server. */
27 32
	private CloudSolrServer server;
28 33

  
34
	/**
35
	 * The Constructor.
36
	 *
37
	 * @param server
38
	 *            the server
39
	 */
29 40
	public SolrIndexCollection(final CloudSolrServer server) {
30 41
		this.server = server;
31 42
	}
32 43

  
44
	/**
45
	 * {@inheritDoc}
46
	 *
47
	 * @see eu.dnetlib.functionality.index.IndexCollection#add(eu.dnetlib.functionality.index.model.document.IndexDocument)
48
	 */
33 49
	@Override
34 50
	public boolean add(final IndexDocument doc) throws IndexServiceException {
35 51
		return false;
36 52
	}
37 53

  
54
	/**
55
	 * {@inheritDoc}
56
	 *
57
	 * @see eu.dnetlib.functionality.index.IndexCollection#addAll(java.util.Iterator)
58
	 */
38 59
	@Override
39 60
	public boolean addAll(final Iterator<IndexDocument> docs) throws IndexServiceException {
40 61
		// TODO Auto-generated method stub
41 62
		return false;
42 63
	}
43 64

  
65
	/**
66
	 * {@inheritDoc}
67
	 *
68
	 * @see eu.dnetlib.functionality.index.IndexCollection#addAll(java.util.Collection)
69
	 */
44 70
	@Override
45 71
	public boolean addAll(final Collection<IndexDocument> docs) throws IndexServiceException {
46 72
		// TODO Auto-generated method stub
47 73
		return false;
48 74
	}
49 75

  
76
	/**
77
	 * {@inheritDoc}
78
	 *
79
	 * @see eu.dnetlib.functionality.index.IndexCollection#deleteIndex(java.lang.String)
80
	 */
50 81
	@Override
51 82
	public boolean deleteIndex(final String dsId) throws IndexServiceException {
52 83
		return doDelete(IndexFieldUtility.ALL_FIELDS + " exact \"" + dsId + "\"");
53 84
	}
54 85

  
86
	/**
87
	 * {@inheritDoc}
88
	 *
89
	 * @see eu.dnetlib.functionality.index.IndexCollection#deleteByQuery(java.lang.String, java.lang.String)
90
	 */
55 91
	@Override
56 92
	public boolean deleteByQuery(final String query, final String dsId) throws IndexServiceException {
57 93
		if (StringUtils.isBlank(dsId)) return doDelete(query);
58 94
		return doDelete(query + " and " + IndexFieldUtility.ALL_FIELDS + " exact \"" + dsId + "\"");
59 95
	}
60 96

  
97
	/**
98
	 * Do delete.
99
	 *
100
	 * @param query
101
	 *            the query
102
	 * @return true, if do delete
103
	 * @throws IndexServiceException
104
	 *             the index service exception
105
	 */
61 106
	protected boolean doDelete(final String query) throws IndexServiceException {
62 107
		try {
63 108
			log.debug("delete by query: " + query);
......
67 112
		}
68 113
	}
69 114

  
115
	/**
116
	 * {@inheritDoc}
117
	 *
118
	 * @see eu.dnetlib.functionality.index.IndexCollection#commit()
119
	 */
70 120
	@Override
71 121
	public boolean commit() throws IndexServiceException {
72 122
		try {
......
76 126
		}
77 127
	}
78 128

  
129
	/**
130
	 * {@inheritDoc}
131
	 *
132
	 * @see eu.dnetlib.functionality.index.IndexCollection#lookup(eu.dnetlib.functionality.index.query.IndexQuery,
133
	 *      eu.dnetlib.functionality.index.utils.MetadataReference)
134
	 */
79 135
	@Override
80 136
	public QueryResponseParser lookup(final IndexQuery contextualQuery, final MetadataReference mdRef) {
81 137
		// TODO Auto-generated method stub
modules/dnet-index-solr-service/trunk/src/main/resources/eu/dnetlib/functionality/index/applicationContext-index-solr-service.properties
1
service.solr.index.staticConfigurationClasspath=
2
service.solr.index.jsonConfiguration=
3
service.index.solr.schema.textfieldtype=
modules/dnet-index-solr-service/trunk/src/main/resources/eu/dnetlib/functionality/index/applicationContext-index-solr-service.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
4
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:wsa="http://cxf.apache.org/ws/addressing"
5
	xmlns:p="http://www.springframework.org/schema/p" xmlns:http="http://cxf.apache.org/transports/http/configuration"
6
	xmlns:t="http://dnetlib.eu/springbeans/t" xmlns:template="http://dnetlib.eu/springbeans/template"
7
	xmlns:util="http://www.springframework.org/schema/util"
8
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
9
						http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
10
						http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
11
						http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
12
						http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
13
						http://dnetlib.eu/springbeans/template http://dnetlib.eu/springbeans/template.xsd
14
						http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
15
		
16
		
17
		
18
		
19
		<bean id ="solrIndexServerDAO" class="eu.dnetlib.functionality.index.SolrIndexServerDAO"
20
			p:jsonConfiguration="${service.solr.index.jsonConfiguration}" />		
21
				
22
		<bean id="zkUtils" class="eu.dnetlib.functionality.index.utils.ZkUtils"
23
			p:staticConfigurationClasspath="${service.solr.index.staticConfigurationClasspath}"
24
			p:configFactory-ref="solrIndexConfigFactory" />
25
		 		 
26
		 <bean id="solrConfigTemplate"
27
			class="eu.dnetlib.springutils.stringtemplate.StringTemplateFactory"
28
			p:template="classpath:/eu/dnetlib/functionality/index/conf/solrconfig.xml.st"
29
			scope="prototype" />
30

  
31
		 <bean id="solrIndexConfigFactory" class="eu.dnetlib.functionality.index.utils.IndexConfigFactory"
32
		 	p:solrConfig-ref="solrConfigTemplate" />
33
		 	
34
		 <bean id="solrIndexSchemaFactory" class="eu.dnetlib.functionality.index.utils.IndexSchemaFactory"
35
		 	p:schemaTemplate ="classpath:/eu/dnetlib/functionality/index/conf/schemaTemplate.xslt"
36
		 	p:textFieldType="${service.index.solr.schema.textfieldtype}" />
37
						
38
</beans>

Also available in: Unified diff