Package org.apache.nutch.plugin

## Class PluginDescriptor

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

-     public class PluginDescriptor
      extends Object

  The `PluginDescriptor` provide access to all meta information of a nutch-plugin, as well to the internationalizable resources and the plugin own classloader. There are meta information about `Plugin`, `ExtensionPoint` and `Extension`. To provide access to the meta data of a plugin via a descriptor allow a lazy loading mechanism.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PluginDescriptor​(String pId, String pVersion, String pName, String pProviderName, String pPluginclazz, String pPath, Configuration conf)` | Overloaded constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addDependency​(String pId)` | Adds a dependency
    `void` | `addExportedLibRelative​(String pLibPath)` | Adds a exported library with a relative path to the plugin directory.
    `void` | `addExtension​(Extension pExtension)` | Adds a extension.
    `void` | `addExtensionPoint​(ExtensionPoint extensionPoint)` | Adds a extension point.
    `void` | `addNotExportedLibRelative​(String pLibPath)` | Adds a non-exported library with a relative path to the plugin directory.
    `PluginClassLoader` | `getClassLoader()` | Returns a cached classloader for a plugin.
    `String[]` | `getDependencies()` | Returns a array of plugin ids.
    `URL[]` | `getExportedLibUrls()` | Returns a array of exported libs as URLs
    `Extension[]` | `getExtensions()` | Returns an array of extensions.
    `ExtensionPoint[]` | `getExtenstionPoints()` | Returns a array of extension points.
    `String` | `getName()` | Returns the name of the plugin.
    `URL[]` | `getNotExportedLibUrls()` | Returns a array of libraries as URLs that are not exported by the plugin.
    `String` | `getPluginClass()` | Returns the fully qualified name of the class which implements the abstarct `Plugin` class.
    `String` | `getPluginId()` | Returns the unique identifier of the plug-in or `null`.
    `String` | `getPluginPath()` | Returns the directory path of the plugin.
    `String` | `getProviderName()` |
    `String` | `getResourceString​(String pKey, Locale pLocale)` | Returns a I18N'd resource string.
    `String` | `getVersion()` |

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

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

- - ### Constructor Detail

    - #### PluginDescriptor

          public PluginDescriptor​(String pId,
                                  String pVersion,
                                  String pName,
                                  String pProviderName,
                                  String pPluginclazz,
                                  String pPath,
                                  Configuration conf)

      Overloaded constructor
      Parameters:
        `pId` - set plugin ID
        `pVersion` - set plugin version
        `pName` - set plugin name
        `pProviderName` - set plugin provider name
        `pPluginclazz` - set plugin Class
        `pPath` - set plugin path
        `conf` - a populated `Configuration`

  - ### Method Detail

    - #### getName

          public String getName()

      Returns the name of the plugin.
      Returns:
        String

    - #### getPluginClass

          public String getPluginClass()

      Returns the fully qualified name of the class which implements the abstarct `Plugin` class.
      Returns:
        the name of this plug-in's runtime class or `null`.

    - #### getPluginId

          public String getPluginId()

      Returns the unique identifier of the plug-in or `null`.
      Returns:
        String

    - #### getExtensions

          public Extension[] getExtensions()

      Returns an array of extensions.
      Returns:
        Exception[]

    - #### addExtension

          public void addExtension​(Extension pExtension)

      Adds a extension.
      Parameters:
        `pExtension` - a `Extension`

    - #### addExtensionPoint

          public void addExtensionPoint​(ExtensionPoint extensionPoint)

      Adds a extension point.
      Parameters:
        `extensionPoint` - a `ExtensionPoint`

    - #### getExtenstionPoints

          public ExtensionPoint[] getExtenstionPoints()

      Returns a array of extension points.
      Returns:
        ExtensionPoint[]

    - #### getDependencies

          public String[] getDependencies()

      Returns a array of plugin ids.
      Returns:
        String[]

    - #### addDependency

          public void addDependency​(String pId)

      Adds a dependency
      Parameters:
        `pId` - id of the dependent plugin

    - #### addExportedLibRelative

          public void addExportedLibRelative​(String pLibPath)
                                      throws MalformedURLException

      Adds a exported library with a relative path to the plugin directory. We automatically escape characters that are illegal in URLs. It is recommended that code converts an abstract pathname into a `URL` by first converting it into a `URI`, via the `URL.toURI()` method, and then converting the `URI` into a `URL` via the `URI.toURL()` method.
      Parameters:
        `pLibPath` - path to a exported library relative to the plugin directory
      Throws:
        `MalformedURLException` - if the pLibPath is not a relative path (to the plugin directory)

    - #### getPluginPath

          public String getPluginPath()

      Returns the directory path of the plugin.
      Returns:
        String

    - #### getExportedLibUrls

          public URL[] getExportedLibUrls()

      Returns a array of exported libs as URLs
      Returns:
        URL[]

    - #### addNotExportedLibRelative

          public void addNotExportedLibRelative​(String pLibPath)
                                         throws MalformedURLException

      Adds a non-exported library with a relative path to the plugin directory. We automatically escape characters that are illegal in URLs. It is recommended that code converts an abstract pathname into a `URL` by first converting it into a `URI`, via the `URL.toURI()` method, and then converting the `URI` into a `URL` via the `URI.toURL()` method.
      Parameters:
        `pLibPath` - path to a exported library relative to the plugin directory
      Throws:
        `MalformedURLException` - if the pLibPath is not a relative path (to the plugin directory)

    - #### getNotExportedLibUrls

          public URL[] getNotExportedLibUrls()

      Returns a array of libraries as URLs that are not exported by the plugin.
      Returns:
        URL[]

    - #### getClassLoader

          public PluginClassLoader getClassLoader()

      Returns a cached classloader for a plugin. Until classloader creation all needed libraries are collected. A classloader use as first the plugins own libraries and add then all exported libraries of dependend plugins.
      Returns:
        PluginClassLoader the classloader for the plugin

    - #### getResourceString

          public String getResourceString​(String pKey,
                                          Locale pLocale)
                                   throws IOException

      Returns a I18N'd resource string. The resource bundles could be stored in root directory of a plugin in the well known i18n file name conventions.
      Parameters:
        `pKey` - a plugin key
        `pLocale` - the required `Locale`
      Returns:
        a string for the given key from the `ResourceBundle` bundle or one of its parents
      Throws:
        `IOException` - if there is an error obtaining the key

    - #### getProviderName

          public String getProviderName()

    - #### getVersion

          public String getVersion()