You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Robert Krüger <kr...@lesspain.de> on 2014/02/13 06:47:31 UTC

Allow scoped classpath resource loading for core

Hi,

to solve the problem described in this posting,

http://lucene.472066.n3.nabble.com/Set-up-embedded-Solr-container-and-cores-programmatically-to-read-their-configs-from-the-classpath-td4116641.html

I am looking at ways to modify the API or the behaviour of existing
methods to propose a patch. Here are my thoughts:

1) allow a custom resource loader to be specified in
org.apache.solr.core.CoreContainer#create
2) change SolrResourceLoader so that it looks for resources like this:
   * $configDir/$resource (if resource is not absolute)
   * $CWD/$resource
   * $configDir/$resource in classpath     <---- new
   * $resource in classpath

The newly added behaviour in 2) seems to be already there but it is
seemingly just for testing:

   // This is a hack just for tests (it is not done in ZKResourceLoader)!
      // -> the getConfigDir's path must not be absolute!
      if (is == null && System.getProperty("jetty.testMode") != null
&& !new File(getConfigDir()).isAbsolute()) {
        is = classLoader.getResourceAsStream((getConfigDir() +
resource).replace(File.separatorChar, '/'));
      }

Would one of these approaches be accepted as a patch?

Thanks,

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org