You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Yonik Seeley <yo...@apache.org> on 2008/03/25 22:52:02 UTC
Re: svn commit: r640843 - in /lucene/solr/trunk: client/java/solrj/test/org/apache/solr/client/solrj/ src/java/org/apache/solr/core/ src/webapp/src/org/apache/solr/servlet/ src/webapp/web/ src/webapp/web/admin/
Looks like there are still some jsp files that reference SolrMultiCore
after this change.
-Yonik
On Tue, Mar 25, 2008 at 11:01 AM, <ry...@apache.org> wrote:
> Author: ryan
> Date: Tue Mar 25 08:01:23 2008
> New Revision: 640843
>
> URL: http://svn.apache.org/viewvc?rev=640843&view=rev
> Log:
> SOLR-350 -- removed static access for SolrMultiCore. Also adding a new constructor to MultiCore
>
> Removed:
> lucene/solr/trunk/src/java/org/apache/solr/core/SolrMultiCore.java
> Modified:
> lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
> lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java
> lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
> lucene/solr/trunk/src/webapp/web/admin/index.jsp
> lucene/solr/trunk/src/webapp/web/index.jsp
>
> Modified: lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java?rev=640843&r1=640842&r2=640843&view=diff
> ==============================================================================
> --- lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java (original)
> +++ lucene/solr/trunk/client/java/solrj/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java Tue Mar 25 08:01:23 2008
> @@ -34,8 +34,7 @@
> */
> public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase
> {
> - @SuppressWarnings("deprecation")
> - protected static final MultiCore multicore = org.apache.solr.core.SolrMultiCore.getInstance();
> + protected static final MultiCore multicore = new MultiCore();
>
> @Override public String getSolrHome() { return "../../../example/multicore/"; }
>
>
> Modified: lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java?rev=640843&r1=640842&r2=640843&view=diff
> ==============================================================================
> --- lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java (original)
> +++ lucene/solr/trunk/src/java/org/apache/solr/core/MultiCore.java Tue Mar 25 08:01:23 2008
> @@ -63,6 +63,21 @@
> protected java.lang.ref.WeakReference<SolrCore> adminCore = null;
>
> public MultiCore() {
> +
> + }
> +
> + /**
> + * Initalize MultiCore directly from the constructor
> + *
> + * @param dir
> + * @param configFile
> + * @throws ParserConfigurationException
> + * @throws IOException
> + * @throws SAXException
> + */
> + public MultiCore(String dir, File configFile ) throws ParserConfigurationException, IOException, SAXException
> + {
> + this.load(dir, configFile);
> }
>
> //-------------------------------------------------------------------
>
> Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java?rev=640843&r1=640842&r2=640843&view=diff
> ==============================================================================
> --- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java (original)
> +++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java Tue Mar 25 08:01:23 2008
> @@ -74,7 +74,7 @@
> this.multicore = initMultiCore(config);
>
> if(multicore != null && multicore.isEnabled() ) {
> - abortOnConfigurationError = false;
> + abortOnConfigurationError = false;
> singlecore = null;
> // if any core aborts on startup, then abort
> for( SolrCore c : multicore.getCores() ) {
> @@ -132,24 +132,18 @@
> }
>
> /**
> - * Initializes the multicore instance.
> + * Initialize the multicore instance.
> * @param config the filter configuration
> * @return the multicore instance or null
> * @throws java.lang.Exception
> */
> protected MultiCore initMultiCore(FilterConfig config) throws Exception {
> - @SuppressWarnings("deprecation") // since SolrDispatchFilter can be derived & initMultiCore can be overriden
> - MultiCore mcore = org.apache.solr.core.SolrMultiCore.getInstance();
> - if (mcore.isEnabled()) {
> - log.info("Using existing multicore configuration");
> - } else {
> - // multicore load
> - String instanceDir = SolrResourceLoader.locateInstanceDir();
> - File fconf = new File(instanceDir, "multicore.xml");
> - log.info("looking for multicore.xml: " + fconf.getAbsolutePath());
> - if (fconf.exists()) {
> - mcore.load(instanceDir, fconf);
> - }
> + MultiCore mcore = new MultiCore();
> + String instanceDir = SolrResourceLoader.locateInstanceDir();
> + File fconf = new File(instanceDir, "multicore.xml");
> + log.info("looking for multicore.xml: " + fconf.getAbsolutePath());
> + if (fconf.exists()) {
> + mcore.load(instanceDir, fconf);
> }
> return mcore;
> }
> @@ -302,6 +296,7 @@
> // a servlet/jsp can retrieve it
> else {
> req.setAttribute("org.apache.solr.SolrCore", core);
> + req.setAttribute("org.apache.solr.MultiCore", multicore);
> // Modify the request so each core gets its own /admin
> if( singlecore == null && path.startsWith( "/admin" ) ) {
> req.getRequestDispatcher( pathPrefix == null ? path : pathPrefix + path ).forward( request, response );
>
> Modified: lucene/solr/trunk/src/webapp/web/admin/index.jsp
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/index.jsp?rev=640843&r1=640842&r2=640843&view=diff
> ==============================================================================
> --- lucene/solr/trunk/src/webapp/web/admin/index.jsp (original)
> +++ lucene/solr/trunk/src/webapp/web/admin/index.jsp Tue Mar 25 08:01:23 2008
> @@ -48,7 +48,8 @@
> </tr>
>
> <%-- List the cores (that arent this one) so we can switch --%>
> -<% java.util.Collection<SolrCore> cores = org.apache.solr.core.SolrMultiCore.getInstance().getCores();
> +<% org.apache.solr.core.MultiCore multicore = (org.apache.solr.core.MultiCore)request.getAttribute("org.apache.solr.MultiCore");
> + java.util.Collection<SolrCore> cores = multicore.getCores();
> if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></td><td><%
> java.util.Iterator<SolrCore> icore = cores.iterator();
> while (icore.hasNext()) {
>
> Modified: lucene/solr/trunk/src/webapp/web/index.jsp
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/index.jsp?rev=640843&r1=640842&r2=640843&view=diff
> ==============================================================================
> --- lucene/solr/trunk/src/webapp/web/index.jsp (original)
> +++ lucene/solr/trunk/src/webapp/web/index.jsp Tue Mar 25 08:01:23 2008
> @@ -28,7 +28,7 @@
> <a href="."><img border="0" align="right" height="61" width="142" src="admin/solr-head.gif" alt="Solr"/></a>
>
> <%
> - org.apache.solr.core.MultiCore multicore = org.apache.solr.core.SolrMultiCore.getInstance();
> + org.apache.solr.core.MultiCore multicore = (org.apache.solr.core.MultiCore)request.getAttribute("org.apache.solr.core.MultiCore");
> if( multicore.isEnabled() ) {
> for( org.apache.solr.core.SolrCore core : multicore.getCores() ) {%>
> <a href="<%= core.getName() %>/admin/">Admin <%= core.getName() %> </a><br/>
>
>
>
Re: svn commit: r640843 - in /lucene/solr/trunk: client/java/solrj/test/org/apache/solr/client/solrj/ src/java/org/apache/solr/core/ src/webapp/src/org/apache/solr/servlet/ src/webapp/web/ src/webapp/web/admin/
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 25, 2008, at 5:52 PM, Yonik Seeley wrote:
> Looks like there are still some jsp files that reference SolrMultiCore
> after this change.
I think I've fixed them all up now.
Within Solr, JSPs: -1 ... sure would be nice if the bulk of those
things were converted to request handlers :)
And that multicore stuff - needs some more work in SolrDispatchFilter
and those JSPs to be much cleaner - too many paths/conditions. Seems
like we could pretty much assume multicore everywhere and simply have
the single-core case be backwards compatible by pointing to cores[0]
or something like that.
Erik