Revision 7589
Added by ben leinfelder over 11 years ago
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/ApplicationController.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
import org.apache.commons.logging.Log; |
32 | 32 |
import org.apache.commons.logging.LogFactory; |
33 |
import org.apache.solr.client.solrj.SolrServer; |
|
33 | 34 |
import org.springframework.context.ApplicationContext; |
34 | 35 |
import org.springframework.context.support.FileSystemXmlApplicationContext; |
35 | 36 |
|
... | ... | |
41 | 42 |
public class ApplicationController { |
42 | 43 |
|
43 | 44 |
private static String SOLRINDEXES = "solrIndexes"; |
45 |
|
|
44 | 46 |
private List<SolrIndex> solrIndexes = null; |
45 | 47 |
private static ApplicationContext context = null; |
46 | 48 |
private String springConfigFile = "src/main/resources/index-processor-context.xml"; |
... | ... | |
63 | 65 |
} |
64 | 66 |
|
65 | 67 |
/** |
66 |
* Init the list of the SolrIndex objects from the configuration file. |
|
67 |
* Start listening to the shared Hazelcast structures |
|
68 |
* Initialize the list of the SolrIndex objects from the configuration file. |
|
69 |
* Set the SolrServer implementation using the factory. |
|
70 |
* Start listening for events on Hazelcast |
|
68 | 71 |
*/ |
69 | 72 |
private void init() { |
70 | 73 |
context = getContext(); |
71 | 74 |
solrIndexes = (List<SolrIndex>) context.getBean(SOLRINDEXES); |
72 | 75 |
|
76 |
// TODO: use factory to create the correct impl |
|
77 |
SolrServer solrServer = null; |
|
78 |
|
|
73 | 79 |
// start the SystemMetadata listener[s] (only expect there to be one) |
74 | 80 |
for (SolrIndex solrIndex: solrIndexes) { |
81 |
// set the solr server to use |
|
82 |
solrIndex.setSolrServer(solrServer); |
|
83 |
|
|
84 |
// start listening for events |
|
75 | 85 |
SystemMetadataEventListener smel = new SystemMetadataEventListener(); |
76 | 86 |
smel.setSolrIndex(solrIndex); |
77 | 87 |
smel.start(); |
... | ... | |
79 | 89 |
|
80 | 90 |
} |
81 | 91 |
|
82 |
/* |
|
92 |
/**
|
|
83 | 93 |
* Get the ApplicaionContext of Spring. |
84 | 94 |
*/ |
85 | 95 |
private ApplicationContext getContext() { |
Also available in: Unified diff
add place-holder for using SolrServerFactory to get the correct SOlrServer impl during application init