that acts as kind of
Publisher.
| Method from org.apache.nutch.plugin.Extension Detail: |
public void addAttribute(String pKey,
String pValue) {
fAttributes.put(pKey, pValue);
}
Adds a attribute and is only used until model creation at plugin system
start up. |
public String getAttribute(String pKey) {
return fAttributes.get(pKey);
}
Returns a attribute value, that is setuped in the manifest file and is
definied by the extension point xml schema. |
public String getClazz() {
return fClazz;
}
Returns the full class name of the extension point implementation |
public PluginDescriptor getDescriptor() {
return fDescriptor;
}
return the plugin descriptor. |
public Object getExtensionInstance() throws PluginRuntimeException {
// Must synchronize here to make sure creation and initialization
// of a plugin instance and it extension instance are done by
// one and only one thread.
// The same is in PluginRepository.getPluginInstance().
// Suggested by Stefan Groschupf < sg@media-style.com >
synchronized (getId()) {
try {
PluginClassLoader loader = fDescriptor.getClassLoader();
Class extensionClazz = loader.loadClass(getClazz());
// lazy loading of Plugin in case there is no instance of the plugin
// already.
this.pluginRepository.getPluginInstance(getDescriptor());
Object object = extensionClazz.newInstance();
if (object instanceof Configurable) {
((Configurable) object).setConf(this.conf);
}
return object;
} catch (ClassNotFoundException e) {
throw new PluginRuntimeException(e);
} catch (InstantiationException e) {
throw new PluginRuntimeException(e);
} catch (IllegalAccessException e) {
throw new PluginRuntimeException(e);
}
}
}
Return an instance of the extension implementatio. 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 same
PluginClassLoader. Each Plugin use its own classloader. The
PluginClassLoader knows only own Plugin runtime libraries setuped
in the plugin manifest file and exported libraries of the depenedend
plugins. |
public String getId() {
return fId;
}
Return the unique id of the extension. |
public String getTargetPoint() {
return fTargetPoint;
}
Returns the Id of the extension point, that is implemented by this
extension. |
public void setClazz(String extensionClazz) {
fClazz = extensionClazz;
}
Sets the Class that implement the concret extension and is only used until
model creation at system start up. |
public void setDescriptor(PluginDescriptor pDescriptor) {
fDescriptor = pDescriptor;
}
Sets the plugin descriptor and is only used until model creation at system
start up. |
public void setId(String extensionID) {
fId = extensionID;
}
Sets the unique extension Id and is only used until model creation at
system start up. |