Package org.apache.nutch.plugin
Class Extension
- java.lang.Object
-
- org.apache.nutch.plugin.Extension
-
public class Extension extends Object
AnExtensionis a kind of listener descriptor that will be installed on a concreteExtensionPointthat acts as kind of Publisher.
-
-
Constructor Summary
Constructors Constructor Description Extension(PluginDescriptor pDescriptor, String pExtensionPoint, String pId, String pExtensionClass, Configuration conf, PluginRepository pluginRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(String pKey, String pValue)Adds a attribute and is only used until model creation at plugin system start up.StringgetAttribute(String pKey)Returns a attribute value, that is setuped in the manifest file and is definied by the extension point xml schema.StringgetClazz()Returns the full class name of the extension point implementationPluginDescriptorgetDescriptor()Get the plugin descriptor.ObjectgetExtensionInstance()Return an instance of the extension implementation.StringgetId()Return the unique id of the extension.StringgetTargetPoint()Get target pointvoidsetClazz(String extensionClazz)Sets the Class that implement the concret extension and is only used until model creation at system start up.voidsetDescriptor(PluginDescriptor pDescriptor)Sets the plugin descriptor and is only used until model creation at system start up.voidsetId(String extensionID)Sets the unique extension Id and is only used until model creation at system start up.StringtoString()
-
-
-
Constructor Detail
-
Extension
public Extension(PluginDescriptor pDescriptor, String pExtensionPoint, String pId, String pExtensionClass, Configuration conf, PluginRepository pluginRepository)
- Parameters:
pDescriptor- a plugin descriptorpExtensionPoint- an extension pointpId- an unique id of the pluginpExtensionClass- the class extending the extension pointconf- a populatedConfigurationpluginRepository- aPluginRepositorycontaining all plugin artifacts
-
-
Method Detail
-
getAttribute
public String getAttribute(String pKey)
Returns a attribute value, that is setuped in the manifest file and is definied by the extension point xml schema.- Parameters:
pKey- a key- Returns:
- String a value
-
getClazz
public String getClazz()
Returns the full class name of the extension point implementation- Returns:
- String
-
getId
public String getId()
Return the unique id of the extension.- Returns:
- String
-
addAttribute
public void addAttribute(String pKey, String pValue)
Adds a attribute and is only used until model creation at plugin system start up.- Parameters:
pKey- a keypValue- a value
-
setClazz
public void setClazz(String extensionClazz)
Sets the Class that implement the concret extension and is only used until model creation at system start up.- Parameters:
extensionClazz- The extensionClasname to set
-
setId
public void setId(String extensionID)
Sets the unique extension Id and is only used until model creation at system start up.- Parameters:
extensionID- The extensionID to set
-
getTargetPoint
public String getTargetPoint()
Get target point- Returns:
- the Id of the extension point, that is implemented by this extension.
-
getExtensionInstance
public Object getExtensionInstance() throws PluginRuntimeException
Return an instance of the extension implementation. Before we create a extension instance we startup the plugin if it is not already done. The plugin instance and the extension instance use the samePluginClassLoader. Each Plugin uses its own classloader. ThePluginClassLoaderknows only its own plugin runtime libraries defined in theplugin.xmlmanifest file and exported libraries of the dependent plugins.- Returns:
- Object An instance of the extension implementation
- Throws:
PluginRuntimeException- if there is a fatal runtime error
-
getDescriptor
public PluginDescriptor getDescriptor()
Get the plugin descriptor.- Returns:
- PluginDescriptor
-
setDescriptor
public void setDescriptor(PluginDescriptor pDescriptor)
Sets the plugin descriptor and is only used until model creation at system start up.- Parameters:
pDescriptor- a instantiatedPluginDescriptor
-
-