org.apache.nutch.plugin

## Class PluginRepository

- java.lang.Object
- - org.apache.nutch.plugin.PluginRepository

-     public class PluginRepository
      extends java.lang.Object

  The plugin repositority is a registry of all plugins. At system boot up a repositority is builded by parsing the mainifest files of all plugins. Plugins that require not existing other plugins are not registed. For each plugin a plugin descriptor instance will be created. The descriptor represents all meta information about a plugin. So a plugin instance will be created later when it is required, this allow lazy plugin loading.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.slf4j.Logger` | `LOG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PluginRepository(Configuration conf)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `finalize()`
    `static PluginRepository` | `get(Configuration conf)`
    `java.lang.Class` | `getCachedClass(PluginDescriptor pDescriptor, java.lang.String className)`
    `ExtensionPoint` | `getExtensionPoint(java.lang.String pXpId)` Returns a extension point indentified by a extension point id.
    `java.lang.Object[]` | `getOrderedPlugins(java.lang.Class<?> clazz, java.lang.String xPointId, java.lang.String orderProperty)` Get ordered list of plugins.
    `PluginDescriptor` | `getPluginDescriptor(java.lang.String pPluginId)` Returns the descriptor of one plugin identified by a plugin id.
    `PluginDescriptor[]` | `getPluginDescriptors()` Returns all registed plugin descriptors.
    `Plugin` | `getPluginInstance(PluginDescriptor pDescriptor)` Returns a instance of a plugin.
    `static void` | `main(java.lang.String[] args)` Loads all necessary dependencies for a selected plugin, and then runs one of the classes' main() method.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### LOG

          protected static final org.slf4j.Logger LOG

  - ### Constructor Detail

    - #### PluginRepository

          public PluginRepository(Configuration conf)
                           throws java.lang.RuntimeException

      Throws:
        `java.lang.RuntimeException`
      See Also:
        `Object.Object()`

  - ### Method Detail

    - #### get

          public static PluginRepository get(Configuration conf)

      Returns:
        a cached instance of the plugin repository

    - #### getPluginDescriptors

          public PluginDescriptor[] getPluginDescriptors()

      Returns all registed plugin descriptors.
      Returns:
        PluginDescriptor[]

    - #### getPluginDescriptor

          public PluginDescriptor getPluginDescriptor(java.lang.String pPluginId)

      Returns the descriptor of one plugin identified by a plugin id.
      Parameters:
        `pPluginId` -
      Returns:
        PluginDescriptor

    - #### getExtensionPoint

          public ExtensionPoint getExtensionPoint(java.lang.String pXpId)

      Returns a extension point indentified by a extension point id.
      Parameters:
        `pXpId` -
      Returns:
        a extentsion point

    - #### getPluginInstance

          public Plugin getPluginInstance(PluginDescriptor pDescriptor)
                                   throws PluginRuntimeException

      Returns a instance of a plugin. Plugin instances are cached. So a plugin exist only as one instance. This allow a central management of plugin own resources. After creating the plugin instance the startUp() method is invoked. The plugin use a own classloader that is used as well by all instance of extensions of the same plugin. This class loader use all exported libraries from the dependend plugins and all plugin libraries.
      Parameters:
        `pDescriptor` -
      Returns:
        Plugin
      Throws:
        `PluginRuntimeException`

    - #### finalize

          public void finalize()
                        throws java.lang.Throwable

      Overrides:
        `finalize` in class `java.lang.Object`
      Throws:
        `java.lang.Throwable`

    - #### getCachedClass

          public java.lang.Class getCachedClass(PluginDescriptor pDescriptor,
                                                java.lang.String className)
                                         throws java.lang.ClassNotFoundException

      Throws:
        `java.lang.ClassNotFoundException`

    - #### getOrderedPlugins

          public java.lang.Object[] getOrderedPlugins(java.lang.Class<?> clazz,
                                                      java.lang.String xPointId,
                                                      java.lang.String orderProperty)

      Get ordered list of plugins. Filter and normalization plugins are applied in a configurable "pipeline" order, e.g., if one plugin depends on the output of another plugin. This method loads the plugins in the order defined by orderProperty. If orderProperty is empty or unset, all active plugins of the given interface and extension point are loaded.
      Parameters:
        `clazz` - interface class implemented by required plugins
        `xPointId` - extension point id of required plugins
        `orderProperty` - property name defining plugin order
      Returns:
        array of plugin instances

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.lang.Exception

      Loads all necessary dependencies for a selected plugin, and then runs one of the classes' main() method.
      Parameters:
        `args` - plugin ID (needs to be activated in the configuration), and the class name. The rest of arguments is passed to the main method of the selected class.
      Throws:
        `java.lang.Exception`

Copyright © 2019 The Apache Software Foundation