: Another approach to consider, then, is using the server's JNDI
: resources.  The code in the WAR would be the same, looking up the
: configuration file URL (or any other JNDI resource) using the
: java:comp/env space (which is different for every webapp, and portable
: across all J2EE servers/servlet containers), but the server's
: configuration file would specify different values for different
: webapps.  It's not zero configuration like just copying a WAR would
: be, but fairly close.

Just so I'm sure i'm understanding you:  You're saying that any java code
can uses JNDI to access data in the "java:comp/env/" namespace -- and that
the servlet spec requires that all application servers provide some way to
configure what lives in the "java:comp/env/" namespace on a per webapp
basis, independent of the webapp's web.xml (even if it doesn't mandate
what that mechanism is ... resin.conf in resin, server.xml in tomcat,
etc...)

So we could define a JNDI name like "java:comp/env/solr/home" and have
code like this...

    Context c = new InitialContext();
    File home = (File) c.lookup("java:comp/env/solr/home");
    if (null == home)
        home = new File(System.getProperty("solr.home","./solr"));
    }

...to determine the "root" directory for accessing all solr conig files
and data.

This would allow "advanced" users to configure which directory solr used
via JNDI -- even if they want multiple instances on a single server; or if
they only want one instance per server they could use a system property or
just use the default of "./solr" relative the current working directory
where they started the server.

If they were using Tomcat, then (from what i can tell) they would
configure their JNDI options in server.xml like this...

  <Context path="/solr-product-instance" >
    <Environment name="solr/home" value="/var/opt/solr/product"
                 type="java.lang.String" override="true"        />
  </Context>
  <Context path="/solr-article-instance" >
    <Environment name="solr/home" value="/var/opt/solr/articles"
                 type="java.lang.String" override="true"        />
  </Context>

...and just put two copies of solr.war in their webapps directlry: once
named solr-product-instance.war and once named solr-article-instance.war



Do I have that correct?


-Hoss

Reply via email to