use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfigurationProvider in project jackrabbit-oak by apache.
the class SolrIndexEditorProvider method getIndexEditor.
@Override
public Editor getIndexEditor(@Nonnull String type, @Nonnull NodeBuilder definition, @Nonnull NodeState root, @Nonnull IndexUpdateCallback callback) throws CommitFailedException {
SolrIndexEditor editor = null;
if (SolrQueryIndex.TYPE.equals(type)) {
try {
// if index definition contains a persisted configuration, use that
if (isPersistedConfiguration(definition)) {
NodeState nodeState = definition.getNodeState();
OakSolrConfiguration configuration = new OakSolrNodeStateConfiguration(nodeState);
SolrServerConfigurationProvider configurationProvider = new NodeStateSolrServerConfigurationProvider(definition.getChildNode("server").getNodeState());
SolrServer solrServer = new OakSolrServer(configurationProvider);
editor = getEditor(configuration, solrServer, callback);
} else {
// otherwise use the default configuration providers (e.g. defined via code or OSGi)
OakSolrConfiguration configuration = oakSolrConfigurationProvider.getConfiguration();
editor = getEditor(configuration, solrServerProvider.getIndexingSolrServer(), callback);
}
} catch (Exception e) {
log.warn("could not get Solr index editor from {}", definition.getNodeState(), e);
}
}
return editor;
}
use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfigurationProvider in project jackrabbit-oak by apache.
the class SolrServerProviderService method getServer.
private SolrServer getServer() {
SolrServer solrServer = null;
if (serverType != null && !"none".equals(serverType)) {
SolrServerConfigurationProvider solrServerConfigurationProvider = solrServerConfigurationProviders.get(serverType);
if (solrServerConfigurationProvider != null) {
try {
solrServer = new OakSolrServer(solrServerConfigurationProvider);
log.info("created new SolrServer {}", solrServer);
} catch (Exception e) {
log.error("could not get a SolrServerProvider of type {}", serverType, e);
}
}
}
return solrServer;
}
Aggregations