David Smiley created SOLR-17662:
-----------------------------------

             Summary: Java SPI/ServiceLoader for plugin discovery & 
instantiation
                 Key: SOLR-17662
                 URL: https://issues.apache.org/jira/browse/SOLR-17662
             Project: Solr
          Issue Type: Improvement
            Reporter: David Smiley


Java 6 introduced the [Service Provider 
Interfaces|https://docs.oracle.com/javase/tutorial/sound/SPI-intro.html] 
mechanism, implemented with the ServiceLoader class.  As applied to Solr, it 
allows a registry of plugin instances of a certain type to be discovered from 
the classpath.  This obsoletes static hard-coded mappings (see Solr's 
TransformerFactory for one), and it allows easy addition of new plugin 
instances by others simply by supplying a JAR with metadata, without requiring 
modifications to solrconfig.xml or other config files (assuming zero-config).  

A challenge to solve is how to get the basic name of a plugins, e.g. "subquery" 
instead of the full classname: 
org.apache.solr.response.transform.SubQueryAugmenterFactory

A short term goal could just be Solr's static registries of builtin plugins 
using Solr's classpath.  Slightly better is using the node level ClassLoader, 
thereby using the configurable lib dir.  More comprehensive would eventually 
allow configSets and the package system somehow.  Eventually allow referencing 
these plugin names in configuration (class="subquery" or name="subquery") 
instead of "solr.SubQueryAugmenterFactory" for explicitly configuring.  The 
latter should be deprecated despite its use in Solr since forever.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to