Following an example plugin lifecycle

In this context, two methods play a major role: an init() method to handle general parameters, and an inform() method that will handle a different type of object, depending on the Aware interface implemented.

A typical lifecycle of these components will be defined in a few steps. It is shown in the following diagram:

Following an example plugin lifecycle

Let's read the sequence given in the preceding diagram in order:

  1. The Solr instance is started.
  2. The component constructor method is called.
  3. An init() method is called to inject values via its arguments. The parameters accepted here will be of one of the following types such as Map, NamedList, and PluginInfo. The NamedList parameter is a collection designed to be similar to the Map parameter, but it contains repeatable keys.
  4. All the classes implementing ResourceLoaderAware call inform(ResourceLoader) to obtain the information needed.
  5. At last, and yet before the first request, after all the plugins have been registered, all the SolrCoreAware plugins call inform(SolrCore) to obtain the core-specific configurations.
  6. Solr starts processing incoming requests.

You will find more references at the wiki page: http://wiki.apache.org/solr/SolrPlugins. However, starting from this simple schema, it's not too much complex to have an idea on how to proceed for our code. So let's look at some example.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.26.217