Package org.apache.nutch.plugin
Class PluginDescriptor
java.lang.Object
org.apache.nutch.plugin.PluginDescriptor
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
ConstructorsConstructorDescriptionPluginDescriptor(String pId, String pVersion, String pName, String pProviderName, String pPluginclazz, String pPath, Configuration conf) Overloaded constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDependency(String pId) Adds a dependencyvoidaddExportedLibRelative(String pLibPath) Adds a exported library with a relative path to the plugin directory.voidaddExtension(Extension pExtension) Adds a extension.voidaddExtensionPoint(ExtensionPoint extensionPoint) Adds a extension point.voidaddNotExportedLibRelative(String pLibPath) Adds a non-exported library with a relative path to the plugin directory.Returns a cached classloader for a plugin.String[]Returns a array of plugin ids.URL[]Returns a array of exported libs as URLsReturns an array of extensions.Returns a array of extension points.getName()Returns the name of the plugin.URL[]Returns a array of libraries as URLs that are not exported by the plugin.Returns the fully qualified name of the class which implements the abstarctPluginclass.Returns the unique identifier of the plug-in ornull.Returns the directory path of the plugin.getResourceString(String pKey, Locale pLocale) Returns a I18N'd resource string.
-
Constructor Details
-
PluginDescriptor
public PluginDescriptor(String pId, String pVersion, String pName, String pProviderName, String pPluginclazz, String pPath, Configuration conf) Overloaded constructor- Parameters:
pId- set plugin IDpVersion- set plugin versionpName- set plugin namepProviderName- set plugin provider namepPluginclazz- set plugin ClasspPath- set plugin pathconf- a populatedConfiguration
-
-
Method Details
-
getName
Returns the name of the plugin.- Returns:
- String
-
getPluginClass
Returns the fully qualified name of the class which implements the abstarctPluginclass.- Returns:
- the name of this plug-in's runtime class or
null.
-
getPluginId
Returns the unique identifier of the plug-in ornull.- Returns:
- String
-
getExtensions
Returns an array of extensions.- Returns:
- Exception[]
-
addExtension
Adds a extension.- Parameters:
pExtension- aExtension
-
addExtensionPoint
Adds a extension point.- Parameters:
extensionPoint- aExtensionPoint
-
getExtenstionPoints
Returns a array of extension points.- Returns:
- ExtensionPoint[]
-
getDependencies
Returns a array of plugin ids.- Returns:
- String[]
-
addDependency
Adds a dependency- Parameters:
pId- id of the dependent plugin
-
addExportedLibRelative
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 aURLby first converting it into aURI, via theURL.toURI()method, and then converting theURIinto aURLvia theURI.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
Returns the directory path of the plugin.- Returns:
- String
-
getExportedLibUrls
Returns a array of exported libs as URLs- Returns:
- URL[]
-
addNotExportedLibRelative
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 aURLby first converting it into aURI, via theURL.toURI()method, and then converting theURIinto aURLvia theURI.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
Returns a array of libraries as URLs that are not exported by the plugin.- Returns:
- URL[]
-
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
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 keypLocale- the requiredLocale- Returns:
- a string for the given key from the
ResourceBundlebundle or one of its parents - Throws:
IOException- if there is an error obtaining the key
-
getProviderName
-
getVersion
-