com.s24.search.solr.analysis.jdbc.DataImportJdbcDataSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solr-jdbc Show documentation
Show all versions of solr-jdbc Show documentation
A simple Solr JDBC connection holder that can be injected by JNDI.
package com.s24.search.solr.analysis.jdbc;
import java.sql.Connection;
import java.util.Properties;
import java.util.concurrent.Callable;
import org.apache.solr.handler.dataimport.Context;
import org.apache.solr.handler.dataimport.JdbcDataSource;
/**
* {@link JdbcDataSource} for data import handlers using data sources from {@link JdbcDataSourceFactory}.
*/
public class DataImportJdbcDataSource extends JdbcDataSource {
@Override
protected Callable createConnectionFactory(Context context, Properties initProps) {
// Suppress failures due to not configured data source.
initProps.setProperty(JNDI_NAME, "dummy");
// Init some internal parameters of JdbcDataSource
super.createConnectionFactory(context, initProps);
javax.sql.DataSource dataSource = JdbcDataSourceFactory.getDataSource(initProps);
return factory = dataSource::getConnection;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy