org.apache.nutch.plugin
Class PluginRepository

java.lang.Object
  extended by org.apache.nutch.plugin.PluginRepository

public class PluginRepository
extends 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.

Author:
joa23

Field Summary
static org.slf4j.Logger LOG
           
 
Constructor Summary
PluginRepository(Configuration conf)
           
 
Method Summary
 void finalize()
           
static PluginRepository get(Configuration conf)
           
 ExtensionPoint getExtensionPoint(String pXpId)
          Returns a extension point indentified by a extension point id.
 PluginDescriptor getPluginDescriptor(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(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

public static final org.slf4j.Logger LOG
Constructor Detail

PluginRepository

public PluginRepository(Configuration conf)
                 throws RuntimeException
Throws:
PluginRuntimeException
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(String pPluginId)
Returns the descriptor of one plugin identified by a plugin id.

Parameters:
pPluginId -
Returns:
PluginDescriptor

getExtensionPoint

public ExtensionPoint getExtensionPoint(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 Throwable
Overrides:
finalize in class Object
Throws:
Throwable

main

public static void main(String[] args)
                 throws 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:
Exception


Copyright © 2011 The Apache Software Foundation