: The cleanest solution is to have a single place manage Aware/Inform. The
: cleanest place for this is in ResourceLoader (refactored Config superclass)

Mmm.... i wasn't assuming it would work that way ... in fact, i was pretty 
sure it couldn't work that way for the reasons you outlined.

it might be possible to have an Generic (big G) Aware<T> type interface 
that gets reused in the specific use cases -- it might even make sense to 
do it that way so that there is a central interface documenting the 
"inform" pattern ... but i don't think we can have (or want) a generic 
(little g) place where *all* inform() calls take place.  the javadocs for 
these "Aware" interfaces should be very specific and constrained about 
who/what plugin types can implement them and when they'll be called 
(and cross linked from the javadocs of all the interfaces/classes 
involved)...

   ResourceLoaderAware
     - can be implemented by:
        * TokenFilterFactory
        * TokenizerFactory
        * FieldType
        * ...others ?
     - it.inform(ResourceLoader) will be called by IndexSearcher after 
       it.init() 
   SolrCoreAware
     - can be implemented by:
        * SolrRequestHandler
        * QueryResponseWriter
        * ...others ?
     - it.inform(SolrCore) will be called by the SolrCore after it.init() 
       ... either at the end of SolrCore.init() or when the SolrCore is 
       first given a refrence to "it"

(the last part being specified to support things not initialized during 
SolrCore.init ... but we may not even need it depending on how constrained 
the list of supported plugin types is -- but with lazy loaded 
RequestHandlers i *think* it's neccessary)

: Alternatively, we can put the Aware/Inform logic in the AbstractPluginLoader
: -- this works fine for ResourceLoaderAware, but gets complicated for

The ResourceLoader case is interesting ... and simple enough that it might 
make sense to relax the contract so that *any* plugin can implement 
ResourceLoaderAware and let AbstractPluginLoader deal with it ... but 
frankly, i'd leave things more constrained for now, and expand them later 
if there is a real use case -- it's easier to start relax a constraint in 
future versions then it is to add one.



-Hoss

Reply via email to