lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r811770 - in /lucene/solr/trunk/src/java/org/apache/solr/core: PluginInfo.java SolrConfig.java
Date Sun, 06 Sep 2009 06:57:59 GMT
Author: noble
Date: Sun Sep  6 06:57:59 2009
New Revision: 811770

URL: http://svn.apache.org/viewvc?rev=811770&view=rev
Log:
SOLR-1198 refactored to make class name also optional

Modified:
    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/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=811770&r1=811769&r2=811770&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 Sun Sep  6 06:57:59 2009
@@ -45,10 +45,10 @@
   }
 
 
-  public PluginInfo(Node node, String err, boolean requireName) {
+  public PluginInfo(Node node, String err, boolean requireName, boolean requireClass) {
     type = node.getNodeName();
     name = DOMUtil.getAttr(node, "name", requireName ? err : null);
-    className = DOMUtil.getAttr(node, "class", err);
+    className = DOMUtil.getAttr(node, "class", requireClass ? err : null);
     isDefault = Boolean.parseBoolean(DOMUtil.getAttr(node, "default", null));
     startup = DOMUtil.getAttr(node, "startup", null);
     initArgs = DOMUtil.childNodesToNamedList(node);

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=811770&r1=811769&r2=811770&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 Sun Sep  6 06:57:59 2009
@@ -190,8 +190,8 @@
 
   protected void loadHighLightingPlugins() {
     highLghtingClass =  get("highlighting/@class",null);
-    highlightingFragmenterInfo = loadPluginInfo("highlighting/fragmenter",true);
-    highlightingFormatterInfo = loadPluginInfo("highlighting/formatter",true);
+    highlightingFragmenterInfo = loadPluginInfo("highlighting/fragmenter",true,true);
+    highlightingFormatterInfo = loadPluginInfo("highlighting/formatter",true, true);
   }
 
   protected UpdateHandlerInfo loadUpdatehandlerInfo() {
@@ -202,17 +202,17 @@
   }
 
   protected void loadPluginInfo() {
-    reqHandlerInfo = loadPluginInfo("requestHandler",true);
-    respWriterInfo = loadPluginInfo("queryResponseWriter",true);
-    valueSourceParserInfo = loadPluginInfo("valueSourceParser",true);
-    queryParserInfo = loadPluginInfo("queryParser",true);
-    searchComponentInfo = loadPluginInfo("searchComponent",true);
-    queryConverterInfo = loadPluginInfo("queryConverter",true);
+    reqHandlerInfo = loadPluginInfo("requestHandler",true, true);
+    respWriterInfo = loadPluginInfo("queryResponseWriter",true, true);
+    valueSourceParserInfo = loadPluginInfo("valueSourceParser",true, true);
+    queryParserInfo = loadPluginInfo("queryParser",true, true);
+    searchComponentInfo = loadPluginInfo("searchComponent",true, true);
+    queryConverterInfo = loadPluginInfo("queryConverter",true, true);
     directoryfactoryInfo = loadSinglePlugin("directoryFactory");
     deletionPolicyInfo = loadSinglePlugin("mainIndex/deletionPolicy");
     indexReaderFactoryInfo = loadSinglePlugin("indexReaderFactory");
-    firstSearcherListenerInfo = loadPluginInfo("//listener[@event='firstSearcher']",false);
-    newSearcherListenerInfo = loadPluginInfo("//listener[@event='newSearcher']",false);
+    firstSearcherListenerInfo = loadPluginInfo("//listener[@event='firstSearcher']",false,
true);
+    newSearcherListenerInfo = loadPluginInfo("//listener[@event='newSearcher']",false, true);
   }
 
   protected Map<String, List<PluginInfo>> loadUpdateProcessorInfo() {
@@ -232,7 +232,7 @@
           }
           ArrayList<PluginInfo> result = new ArrayList<PluginInfo>();
           for (int j=0; j<nl.getLength(); j++) {
-            PluginInfo pluginInfo = new PluginInfo(nl.item(j), "[solrconfig.xml] processor",
false);
+            PluginInfo pluginInfo = new PluginInfo(nl.item(j), "[solrconfig.xml] processor",
false, true);
             if(pluginInfo.isEnabled()) result.add(pluginInfo);
           }
           chains.put(name,result);
@@ -248,15 +248,15 @@
             Collections.unmodifiableMap(chains);
   }
   private PluginInfo loadSinglePlugin(String tag) {
-    List<PluginInfo> l = loadPluginInfo(tag, false);
+    List<PluginInfo> l = loadPluginInfo(tag, false, true);
     return l.isEmpty() ? null : l.get(0);
   }
 
-  private List<PluginInfo> loadPluginInfo(String tag, boolean requireName) {
+  private List<PluginInfo> loadPluginInfo(String tag, boolean requireName, boolean
requireClass) {
     ArrayList<PluginInfo> result = new ArrayList<PluginInfo>();
     NodeList nodes = (NodeList) evaluate(tag, XPathConstants.NODESET);
      for (int i=0; i<nodes.getLength(); i++) {
-       PluginInfo pluginInfo = new PluginInfo(nodes.item(i), "[solrconfig.xml] " + tag, requireName);
+       PluginInfo pluginInfo = new PluginInfo(nodes.item(i), "[solrconfig.xml] " + tag, requireName,
requireClass);
        if(pluginInfo.isEnabled()) result.add(pluginInfo);
      }
     return result.isEmpty() ?
@@ -300,7 +300,8 @@
   protected PluginInfo deletionPolicyInfo;
   protected PluginInfo indexReaderFactoryInfo;
   protected List<PluginInfo> newSearcherListenerInfo;
-  private List<PluginInfo> queryConverterInfo;  
+  protected List<PluginInfo> queryConverterInfo;
+
   protected PluginInfo directoryfactoryInfo;
   protected Map<String ,List<PluginInfo>> updateProcessorChainInfo ;
   protected UpdateHandlerInfo updateHandlerInfo ;



Mime
View raw message