Extension Points#

A plugin consists of an XML file and a collection of class files (compiled source code). The XML file specifies, which points in the source code are extended by the classes. Also, new points in code can be defined that are extensible. We call these points within the code ExtensionPoints, and we call the classes extending these points Extensions. The structure of the XML file is described in more detail in plugin.xml.

For each ExtensionPoint there exists an interface, that have to be implemented by the class extending the ExtensionPoint. Then, the PluginManager provides an array of instances, that define this ExtensionPoint. The array is sorted according to the priority of the extensions. The priority is defined in the XML file as well as the name and the description of the extension.

In addition, it is possible to define further attributes for an ExtensionPoint. These attributes have to be included in the XML file of the implementing extensions.

Working with Scope#

There are only a few Extension Points with a Scope.

Scope for Types#

For the class Type scope defines the father type. For example root is the father of HeaderType.

<extension plugin-id="KnowWEExtensionPoints" point-id="Type" id="HeaderType"> <parameter id="class" value="de.knowwe.jspwiki.types.HeaderType" /> <parameter id="name" value="HeaderType" /> <parameter id="description" value="Represents a HeaderType in KDOM" /> <parameter id="version" value="0.2" /> <parameter id="priority" value="2.1" /> <parameter id="scope" value="root" /> </extension>

Scope for ToolProvider#

For the interface ToolProvider scope defines at which markup the tools should appear. For example the tools of WikiBookDownloadProvider are for WikiBook.

<extension plugin-id="KnowWEExtensionPoints" point-id="ToolProvider" id="WikiBookDownloadProvider"> <parameter id="class" value="com.denkbares.wikibook.WikiBookDownloadProvider" /> <parameter id="name" value="WikiBookDownloadProvider" /> <parameter id="description" value="Offer a download button to download the Wikibook." /> <parameter id="version" value="1.0" /> <parameter id="priority" value="5" /> <parameter id="scope" value="WikiBook" /> </extension>

Scope for SubTreeHandler#

For the interface ToolProvider scope defines at which markup the tools should appear. For example the tools of WikiBookDownloadProvider are for WikiBook.

<extension plugin-id="KnowWEExtensionPoints" point-id="ToolProvider" id="WikiBookDownloadProvider"> <parameter id="class" value="com.denkbares.wikibook.WikiBookDownloadProvider" /> <parameter id="name" value="WikiBookDownloadProvider" /> <parameter id="description" value="Offer a download button to download the Wikibook." /> <parameter id="version" value="1.0" /> <parameter id="priority" value="5" /> <parameter id="scope" value="WikiBook" /> </extension>