lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r809512 - in /lucene/solr/trunk: CHANGES.txt src/java/org/apache/solr/core/PluginInfo.java src/java/org/apache/solr/core/SolrConfig.java src/test/org/apache/solr/TestPluginEnable.java src/test/test-files/solr/conf/solrconfig-enableplugin.xml
Date Mon, 31 Aug 2009 09:16:43 GMT
Author: noble
Date: Mon Aug 31 09:16:41 2009
New Revision: 809512

URL: http://svn.apache.org/viewvc?rev=809512&view=rev
Log:
SOLR-1385 Add an 'enable' attribute to all plugins

Added:
    lucene/solr/trunk/src/test/org/apache/solr/TestPluginEnable.java
    lucene/solr/trunk/src/test/test-files/solr/conf/solrconfig-enableplugin.xml
Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/java/org/apache/solr/core/PluginInfo.java
    lucene/solr/trunk/src/java/org/apache/solr/core/SolrConfig.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=809512&r1=809511&r2=809512&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Mon Aug 31 09:16:41 2009
@@ -288,7 +288,9 @@
 
 73. SOLR-1156: Sort TermsComponent results by frequency (Matt Weber via yonik)
 
-74. SOLR-1384 : load core properties from a properties file (noble) 
+74. SOLR-1335 : load core properties from a properties file (noble)
+
+75. SOLR-1385 : Add an 'enable' attribute to all plugins  (noble)
 
 Optimizations
 ----------------------

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/PluginInfo.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/PluginInfo.java?rev=809512&r1=809511&r2=809512&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/PluginInfo.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/PluginInfo.java Mon Aug 31 09:16:41 2009
@@ -74,4 +74,9 @@
     return sb.toString();
   }
 
+  public boolean isEnabled(){
+    String enable = attributes.get("enable");
+    return enable == null || Boolean.parseBoolean(enable); 
+  }
+
 }

Modified: lucene/solr/trunk/src/java/org/apache/solr/core/SolrConfig.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/SolrConfig.java?rev=809512&r1=809511&r2=809512&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/SolrConfig.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/SolrConfig.java Mon Aug 31 09:16:41 2009
@@ -231,7 +231,8 @@
           }
           ArrayList<PluginInfo> result = new ArrayList<PluginInfo>();
           for (int j=0; j<nl.getLength(); j++) {
-            result.add(new PluginInfo(nl.item(j) ,"[solrconfig.xml] processor",false));
+            PluginInfo pluginInfo = new PluginInfo(nl.item(j), "[solrconfig.xml] processor",
false);
+            if(pluginInfo.isEnabled()) result.add(pluginInfo);
           }
           chains.put(name,result);
           if(isDefault || nodes.getLength() == 1) chains.put(null,result);
@@ -248,7 +249,8 @@
   private PluginInfo loadSinglePlugin(String tag){
      NodeList nodes = (NodeList) evaluate(tag, XPathConstants.NODESET);
      for (int i=0; i<nodes.getLength(); i++) {
-       return new PluginInfo(nodes.item(i) ,"[solrconfig.xml] "+tag,false);
+       PluginInfo pluginInfo = new PluginInfo(nodes.item(i), "[solrconfig.xml] " + tag, false);
+       return pluginInfo.isEnabled() ? pluginInfo : null;
      }
     return null;
   }
@@ -257,7 +259,8 @@
     ArrayList<PluginInfo> result = new ArrayList<PluginInfo>();
     NodeList nodes = (NodeList) evaluate(tag, XPathConstants.NODESET);
      for (int i=0; i<nodes.getLength(); i++) {
-       result.add(new PluginInfo(nodes.item(i) ,"[solrconfig.xml] "+tag,requireName));
+       PluginInfo pluginInfo = new PluginInfo(nodes.item(i), "[solrconfig.xml] " + tag, requireName);
+       if(pluginInfo.isEnabled()) result.add(pluginInfo);
      }
     return result.isEmpty() ?
             Collections.<PluginInfo>emptyList() :

Added: lucene/solr/trunk/src/test/org/apache/solr/TestPluginEnable.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/TestPluginEnable.java?rev=809512&view=auto
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/TestPluginEnable.java (added)
+++ lucene/solr/trunk/src/test/org/apache/solr/TestPluginEnable.java Mon Aug 31 09:16:41 2009
@@ -0,0 +1,33 @@
+package org.apache.solr;
+
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.util.AbstractSolrTestCase;
+
+/**
+ * <p> Test disabling components</p>
+ * @version $Id:$
+ * @since solr 1.4
+ */
+public class TestPluginEnable extends AbstractSolrTestCase {
+
+
+  public void testSimple() throws SolrServerException {
+    assertNull( h.getCore().getRequestHandler("disabled"));
+    assertNotNull( h.getCore().getRequestHandler("enabled"));
+
+  }
+
+
+
+
+    @Override
+    public String getSchemaFile() {
+      return "schema-replication1.xml";
+    }
+
+    @Override
+    public String getSolrConfigFile() {
+      return "solrconfig-enableplugin.xml";
+    }
+
+}

Added: lucene/solr/trunk/src/test/test-files/solr/conf/solrconfig-enableplugin.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/test-files/solr/conf/solrconfig-enableplugin.xml?rev=809512&view=auto
==============================================================================
--- lucene/solr/trunk/src/test/test-files/solr/conf/solrconfig-enableplugin.xml (added)
+++ lucene/solr/trunk/src/test/test-files/solr/conf/solrconfig-enableplugin.xml Mon Aug 31
09:16:41 2009
@@ -0,0 +1,84 @@
+<?xml version="1.0" ?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Id: solrconfig-slave.xml 741684 2009-02-06 19:21:44Z shalin $
+     $Source$
+     $Name$
+  -->
+
+<config>
+
+  <dataDir>${solr.data.dir:./solr/data}</dataDir>
+
+  <indexDefaults>
+    <useCompoundFile>false</useCompoundFile>
+    <mergeFactor>10</mergeFactor>
+    <ramBufferSizeMB>32</ramBufferSizeMB>
+    <maxMergeDocs>2147483647</maxMergeDocs>
+    <maxFieldLength>10000</maxFieldLength>
+    <writeLockTimeout>1000</writeLockTimeout>
+    <commitLockTimeout>10000</commitLockTimeout>
+
+    <writeLockTimeout>1000</writeLockTimeout>
+    <commitLockTimeout>10000</commitLockTimeout>
+
+    <lockType>single</lockType>
+  </indexDefaults>
+
+  <mainIndex>
+    <useCompoundFile>false</useCompoundFile>
+    <mergeFactor>10</mergeFactor>
+    <ramBufferSizeMB>32</ramBufferSizeMB>
+    <maxMergeDocs>2147483647</maxMergeDocs>
+    <maxFieldLength>10000</maxFieldLength>
+
+    <unlockOnStartup>true</unlockOnStartup>
+  </mainIndex>
+
+  <updateHandler class="solr.DirectUpdateHandler2">
+  </updateHandler>
+
+  <requestHandler name="standard" class="solr.StandardRequestHandler">
+    <bool name="httpCaching">true</bool>
+  </requestHandler>
+
+  <!-- test query parameter defaults -->
+  <requestHandler name="defaults" class="solr.StandardRequestHandler">
+
+  </requestHandler>
+
+  <requestHandler name="disabled" class="solr.StandardRequestHandler" enable="false"/>
+  <requestHandler name="enabled" class="solr.StandardRequestHandler" enable="true"/>
+
+
+  <!-- test query parameter defaults -->
+  <requestHandler name="lazy" class="solr.StandardRequestHandler" startup="lazy">
+  </requestHandler>
+
+  <requestHandler name="/update" class="solr.XmlUpdateRequestHandler"/>
+
+  <!-- enable streaming for testing... -->
+  <requestDispatcher handleSelect="true">
+    <requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048"/>
+    <httpCaching lastModifiedFrom="openTime" etagSeed="Solr" never304="false">
+      <cacheControl>max-age=30, public</cacheControl>
+    </httpCaching>
+  </requestDispatcher>
+
+</config>



Mime
View raw message