[ 
https://issues.apache.org/jira/browse/SOLR-336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mo Chen updated SOLR-336:
-------------------------

    Attachment: solr-336-jndi-props.patch

I got the same problem yesterday... and this is a solution following the 
concept of converting JNDI into properties.

The plan is to implement the same <property> from solr.xml in solrconfig.xml, 
and append JNDI supporting to it.
I made 3 changes for the implementation:

  1. Move private method readProperties(Config cfg, Node node) from 
CoreContainer to Config,
     (the method got a Config for the first argument already... so I think that 
will be ok)
     use it to read <property> elements in solrconfig.xml during the 
contruction of Config,
     and overwrite coreProperties before the process 
DOMUtil.substituteProperties.
     (this ensure the mapped JNDI values only take effect in solrconfig.xml, 
but not the system scope)
     
  2. Check property values and replace all 'java:comp/env/xxx' format into JNDI 
value.
     (I write ${:java:comp/env/xxx} for the JNDI ref itself... not very good. 
better solution?)
     
  3. Append some default jndi mapping. In fact only one. The "solr/home" and 
"solr.solr.home"...
     (the priority: <property> in solrconfig -> default jndi mapping -> core 
properties)
     
Now you can got JNDI values in solrconfig.xml like this:

   <property name="solr.solr.home" value="java:comp/env/solr/home" />
   <dataDir>${solr.solr.home:./solr}/data</dataDir>
   
(Or just the second line, this mapping is setted as default)


> Allow setting solr.data.dir with JNDI
> -------------------------------------
>
>                 Key: SOLR-336
>                 URL: https://issues.apache.org/jira/browse/SOLR-336
>             Project: Solr
>          Issue Type: Improvement
>          Components: update
>            Reporter: Stu Hood
>            Priority: Minor
>         Attachments: jndi-data-dir.patch, solr-336-jndi-props.patch
>
>
> I would like to be able set the solr.data.dir with JNDI, as I can for the 
> solr.home property. Currently the data directory is only looked up in the 
> ${solr.home}/conf/solrconfig.xml file, or as a parameter passed into the 
> SolrCore(String, IndexSchema) constructor.
> This allows more options for setting the data directory, such as from within 
> a Servlet container's Context fragment.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to