public class SolrResourceLoader extends Object implements ResourceLoader
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
log |
| Constructor and Description |
|---|
SolrResourceLoader(String instanceDir) |
SolrResourceLoader(String instanceDir,
ClassLoader parent)
This loader will delegate to the context classloader when possible,
otherwise it will attempt to resolve resources using any jar files
found in the "lib/" directory in the specified instance directory.
|
SolrResourceLoader(String instanceDir,
ClassLoader parent,
Properties coreProperties)
This loader will delegate to the context classloader when possible,
otherwise it will attempt to resolve resources using any jar files
found in the "lib/" directory in the specified instance directory.
|
| Modifier and Type | Method and Description |
|---|---|
Class |
findClass(String cname,
String... subpackages)
This method loads a class either with it's FQN or a short-name (solr.class-simplename or class-simplename).
|
ClassLoader |
getClassLoader()
+ * EXPERT
+ *
+ * The underlying class loader.
|
String |
getConfigDir() |
Properties |
getCoreProperties() |
String |
getDataDir() |
String |
getInstanceDir() |
List<String> |
getLines(String resource)
Accesses a resource by name and returns the (non comment) lines
containing data.
|
List<String> |
getLines(String resource,
Charset charset) |
List<String> |
getLines(String resource,
String encoding)
Accesses a resource by name and returns the (non comment) lines containing
data using the given character encoding.
|
void |
inform(Map<String,SolrInfoMBean> infoRegistry)
Register any
SolrInfoMBeans |
void |
inform(ResourceLoader loader)
Tell all
ResourceLoaderAware instances about the loader |
void |
inform(SolrCore core)
Tell all
SolrCoreAware instances about the SolrCore |
static String |
locateInstanceDir()
Deprecated.
|
static String |
locateSolrHome()
Finds the solrhome based on looking up the value in one of three places:
JNDI: via java:comp/env/solr/home
The system property solr.solr.home
Look in the current working directory for a solr/ directory
The return value is normalized.
|
Object |
newAdminHandlerInstance(CoreContainer coreContainer,
String cname,
String... subpackages) |
Object |
newInstance(String cname,
String... subpackages) |
Object |
newInstance(String cName,
String[] subPackages,
Class[] params,
Object[] args) |
static String |
normalizeDir(String path)
Ensures a directory name always ends with a '/'.
|
InputStream |
openConfig(String name)
Opens a config resource by its name.
|
InputStream |
openResource(String resource)
Opens any resource by its name.
|
InputStream |
openSchema(String name)
Opens a schema resource by its name.
|
public SolrResourceLoader(String instanceDir, ClassLoader parent, Properties coreProperties)
This loader will delegate to the context classloader when possible, otherwise it will attempt to resolve resources using any jar files found in the "lib/" directory in the specified instance directory.
instanceDir - - base directory for this resource loader, if null locateSolrHome() will be used.locateSolrHome()public SolrResourceLoader(String instanceDir, ClassLoader parent)
This loader will delegate to the context classloader when possible, otherwise it will attempt to resolve resources using any jar files found in the "lib/" directory in the specified instance directory. If the instance directory is not specified (=null), SolrResourceLoader#locateInstanceDir will provide one.
public SolrResourceLoader(String instanceDir)
public static String normalizeDir(String path)
public String getConfigDir()
public String getDataDir()
public Properties getCoreProperties()
public InputStream openSchema(String name)
public InputStream openConfig(String name)
public InputStream openResource(String resource)
openResource in interface ResourceLoaderpublic List<String> getLines(String resource) throws IOException
A comment line is any line that starts with the character "#"
getLines in interface ResourceLoaderresource - IOExceptionpublic List<String> getLines(String resource, String encoding) throws IOException
A comment line is any line that starts with the character "#"
resource - the file to be readencoding - IOExceptionpublic List<String> getLines(String resource, Charset charset) throws IOException
IOExceptionpublic Class findClass(String cname, String... subpackages)
cname - The name or the short name of the class.subpackages - the packages to be tried if the cnams starts with solr.public Object newInstance(String cname, String... subpackages)
newInstance in interface ResourceLoaderpublic Object newAdminHandlerInstance(CoreContainer coreContainer, String cname, String... subpackages)
public Object newInstance(String cName, String[] subPackages, Class[] params, Object[] args)
public void inform(SolrCore core)
SolrCoreAware instances about the SolrCorepublic void inform(ResourceLoader loader)
ResourceLoaderAware instances about the loaderpublic void inform(Map<String,SolrInfoMBean> infoRegistry)
SolrInfoMBeansinfoRegistry - The Info Registrypublic static String locateSolrHome()
normalizeDir(String)@Deprecated public static String locateInstanceDir()
public String getInstanceDir()
public ClassLoader getClassLoader()
ClassLoader
+