All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.liveSense.service.solr.api.EmbeddedOSGiClientResourceLoader Maven / Gradle / Ivy

Go to download

A Solr embeded server service available or references a remote server. (Derived from Sakai Nakumara - https://github.com/ieb/solr)

The newest version!
package org.liveSense.service.solr.api;

import java.io.IOException;
import java.io.InputStream;

import org.apache.solr.core.SolrResourceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EmbeddedOSGiClientResourceLoader extends SolrResourceLoader {

	public static Logger log = LoggerFactory.getLogger(EmbeddedOSGiClientResourceLoader.class);

	public EmbeddedOSGiClientResourceLoader( String instanceDir, final ClassLoader parent ) {
		super(instanceDir,parent);
		classLoader = new URLClassLoaderWrapper(parent);
	}


	@Override
	public InputStream openResource(String resource) {
		InputStream in = classLoader.getResourceAsStream(resource);
		if ( in == null ) {
			try {
				in = super.openResource(resource);
			} catch (IOException e) {
				log.error("openResource",e);
			}
		}
		return in;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy