lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject 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/
Date Tue, 25 Mar 2008 15:01:26 GMT
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/>



Mime
View raw message