Nutch 1.0 source code analysis [3] Plugin (2), nutchplugin

Source: Internet
Author: User

Nutch 1.0 source code analysis [3] Plugin (2), nutchplugin

Nutch 1.0 source code analysis [3] Plugin (2)

From: http://c.tieba.baidu.com/p/3439551436

In the URLNormalizers constructor, one sentence is not read:

This. ExtensionPoint = PluginRepository.Get(Conf). getExtensionPoint (

URLNormalizer.X_POINT_ID);

Let's take a look at the PluginRepository. get function:

Public static synchronizedPluginRepository get (Configuration conf ){

PluginRepository result =CACHE. Get (conf );

If(Result =Null){

Result =NewPluginRepository (conf );

CACHE. Put (conf, result );

}

ReturnResult;

}

First try to get from the CACHE. If it has not been cached, call the inrepository constructor:

PublicPluginRepository (Configuration conf)ThrowsRuntimeException {

FActivatedPlugins =NewHashMap <String, Plugin> ();

FExtensionPoints =NewHashMap <String, ExtensionPoint> ();

This. Conf = conf;

This. Auto = conf. getBoolean ("plugin. auto-activation ",True);

String [] pluginFolders = conf. getStrings ("plugin. folders ");

PluginManifestParsermanifestParser =NewPluginManifestParser (conf,

This);

Map <String, PluginDescriptor> allPlugins = manifestParser

. ParsePluginFolder (pluginFolders );

Pattern excludes = Pattern.Compile(Conf. get ("plugin. excludes ",""));

Pattern occurrence des = Pattern.Compile(Conf. get ("plugin. includes ",""));

Map <String, PluginDescriptor> filteredPlugins = filter (excludes,

Includes, allPlugins );

FRegisteredPlugins = getDependencyCheckedPlugins (filteredPlugins,

This. Auto? AllPlugins: filteredPlugins );

InstallExtensionPoints (fRegisteredPlugins );

Try{

InstallExtensions (fRegisteredPlugins );

}Catch(PluginRuntimeException e ){

LOG. Fatal (e. toString ());

ThrownewRuntimeException (e. getMessage ());

}

DisplayStatus ();

}

Copy the following description in "analysis of the Nutch plug-in system:

1. plugin. folders: directory where the plug-in is located. The default location is under the plugins directory.

<Property>

<Name> plugin. folders </name>

<Value> plugins </value>

</Property>

2. plugin. auto-activation: whether to enable the plug-in automatically when it is configured as a filter (I .e., not loaded) but dependent on other plug-ins. The default value is true.

<Property>

<Name> plugin. auto-activation </name>

<Value> true </value>

</Property>

3. plugin. Des: List of plug-in names to be included, which can be defined using regular expressions.

<Property>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.