You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by ry...@apache.org on 2007/07/03 10:01:22 UTC
svn commit: r552701 - in /lucene/solr/trunk: CHANGES.txt
src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java
Author: ryan
Date: Tue Jul 3 01:01:21 2007
New Revision: 552701
URL: http://svn.apache.org/viewvc?view=rev&rev=552701
Log:
SOLR-260 adding more comments
Modified:
lucene/solr/trunk/CHANGES.txt
lucene/solr/trunk/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java
Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?view=diff&rev=552701&r1=552700&r2=552701
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Tue Jul 3 01:01:21 2007
@@ -85,7 +85,9 @@
13. SOLR-260: Converting to a standard PluginLoader framework. This reworks
RequestHandlers, FieldTypes, and QueryResponseWriters to share the same
- base code for loading and initalizing plugins. (ryan)
+ base code for loading and initalizing plugins. This adds a new
+ configuration option to define the default RequestHandler and
+ QueryResponseWriter in XML using default="true". (ryan)
14. SOLR-225: Enable pluggable highlighting classes. Allow configurable
highlighting formatters and Fragmenters. (ryan)
Modified: lucene/solr/trunk/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java?view=diff&rev=552701&r1=552700&r2=552701
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/util/plugin/AbstractPluginLoader.java Tue Jul 3 01:01:21 2007
@@ -32,7 +32,6 @@
/**
* An abstract super class that manages standard solr-style plugin configuration.
*
- * @author ryan
* @version $Id$
* @since solr 1.3
*/
@@ -67,9 +66,15 @@
}
/**
- * @param name - The registered name
- * @param className - class name for requested plugin
- * @param params - the parameters specified in the XML
+ * Create a plugin from an XML configuration. Plugins are defined using:
+ * <plugin name="name1" class="solr.ClassName" arg1="val1">
+ * ...
+ * </plugin>
+ *
+ * @param name - The registered name. In the above example: "name1"
+ * @param className - class name for requested plugin. In the above example: "solr.ClassName"
+ * @param params - the parameters specified in the XML. In the example above,
+ * this would be a map containing [name=name1, class=solr.ClassName, arg1=val1]
* @param node - the XML node defining this plugin
*/
@SuppressWarnings("unchecked")
@@ -85,12 +90,42 @@
abstract protected T register( String name, T plugin ) throws Exception;
/**
- * Initialize the plugin
+ * Initialize the plugin. For example, given the configuration:
+ *
+ * <plugin name="name1" class="solr.ClassName" arg1="val1">
+ * ...
+ * </plugin>
+ *
+ * @param plugin - the plugin to initialize
+ * @param params - the parameters specified in the XML. In the example above,
+ * this would be a map containing [name=name1, class=solr.ClassName, arg1=val1]
+ * @param node - the XML node defining this plugin
*/
abstract protected void init( T plugin, Map<String,String> params, Node node ) throws Exception;
/**
- * Given a NodeList from XML, this will
+ * Given a NodeList from XML in the form:
+ *
+ * <plugins>
+ * <plugin name="name1" class="solr.ClassName" >
+ * ...
+ * </plugin>
+ * <plugin name="name2" class="solr.ClassName" >
+ * ...
+ * </plugin>
+ * </plugins>
+ *
+ * This will initialize and register each plugin from the list. A class will
+ * be generated for each class name and registered to the given name.
+ *
+ * If 'preRegister' is true, each plugin will be registered *before* it is initialized
+ * This may be useful for implementations that need to inspect other registered
+ * plugins at startup.
+ *
+ * One (and only one) plugin may declare itself to be the 'default' plugin using:
+ * <plugin name="name2" class="solr.ClassName" default="true">
+ * If a default element is defined, it will be returned from this function.
+ *
*/
public T load( NodeList nodes )
{