Andrzej Bialecki wrote:

URLFilters:

   private URLFilters(NutchConf) {
      // initialize plugins based on this instance of NutchConf
   }

   public static URLFilters get(NutchConf conf) {
      URLFilters res = (URLFilters)conf.get("urlfilters.key");
      if (res == null) {
         res = new URLFilters(conf);
         conf.put("urlfilters.key", res);
      }
      return res;
   }


Looking deeper, this is more messy that I thought... Some changes would be required to the plugin instantiation mechanisms, e.g.:

   Extension.getExtensionInstance() -> getExtensionInstance(NutchConf)
   ExtensionPoint.getExtensions() -> getExtensions(NutchConf)
PluginRepository.getExtensionPoint(String) -> getExtensionPoint(String, NutchConf)

etc, etc...

The way this would work would be similar to the mechanism described above: if plugin instances are not created yet, they would be created once (based on the current NutchConf argument), and then cached in this NutchConf instance.

And also the plugin implementations would have to extend NutchConfigured, taking NutchConf as the argument to their constructors - because now the Extension.getExtensionInstance would pass the current NutchConf instance to their contructors.

--
Best regards,
Andrzej Bialecki     <><
___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com


Reply via email to