Chapter 11. Packaging an add-on for XMLmind XML Editor integrated add-on manager

Table of Contents

1. Why packaging add-ons?
2. Creating useful add-on descriptors

1. Why packaging add-ons?

What is described in this chapter applies to all kinds of add-ons: not only customized configurations in XMLmind XML Editor - Configuration and Deployment containing additional commands, stylesheet extensions, validation hooks, custom attribute editors but also plug-ins or extensions of the GUI of XXE.

Packaging an add-on for XMLmind XML Editor integrated add-on manager (menu item OptionsInstall Add-ons) is not strictly needed. During the development process, it is much quicker to test our extensions by simply copying the relevant files to one of the two addon/ directories scanned by XXE at startup time (more info in Section 1, “Dynamic discovery of add-ons” in XMLmind XML Editor - Configuration and Deployment). Simply do not forget to disable the quick start cache in XMLmind XML Editor - Online Help when you are developing and testing your extensions.

Now you cannot expect the end-user to do the same thing, that's why it is strongly recommended to package add-ons for use by XMLmind XML Editor integrated add-on manager. Fortunately doing so is very easy:

  1. Copy all the files needed by the add-on to a common directory. Example:

    $ mkdir pnm_imagetoolkit-1_0_0
    $ cp pnm_imagetoolkit.jar pnm_imagetoolkit-1_0_0
  2. Add an add-on descriptor to this directory.

    An add-on descriptor is a very simple XML file having a .xxe_addon extension and conforming to the RELAX NG schema contained in the add-on called "A configuration for specifying XMLmind XML Editor add-ons".

    Example of minimal add-on descriptor: pnm_imagetoolkit.xxe_addon:

    <a:addon location="pnm_imagetoolkit.zip"
             xmlns:a="http://www.xmlmind.com/xmleditor/schema/addon">
      <a:category><a:imageToolkitPlugin /></a:category>
      <a:name>PBM, PGM and PPM image toolkit plug-in</a:name>
      <a:version>1.0.0</a:version>
    </a:addon>
  3. Zip this common directory (using 7-Zip or Info-Zip for example). Example:

    $ zip -r pnm_imagetoolkit.zip pnm_imagetoolkit-1_0_0

    The common directory must be included in the .zip file. Example:

    $ unzip -v pnm_imagetoolkit.zip
    pnm_imagetoolkit-1_0_0/
    pnm_imagetoolkit-1_0_0/pnm_imagetoolkit.jar
    pnm_imagetoolkit-1_0_0/pnm_imagetoolkit.xxe_addon
  4. Put the .zip file, along with a copy of your add-on descriptor (pointing to the .zip file as shown in the above example), on a public web site of yours.

    Example: http://www.acme.com/pub/pnm_imagetoolkit.zip and http://www.acme.com/pub/pnm_imagetoolkit.xxe_addon.

  5. Tell your users to drag and drop URL http://www.acme.com/pub/pnm_imagetoolkit.xxe_addon onto the list displayed by XXE Preferences dialog box (OptionsPreferences, Install add-ons section). This step is done once for all, as user preferences are persistent in XXE.

2. Creating useful add-on descriptors

Above example, pnm_imagetoolkit.xxe_addon, is not very informative. It lacks at least an a:abstract element which describes the purpose of the add-on.

Unless you intend to always write minimal add-on descriptors, you'll want to install the XXE configuration which provides support for this document type. This configuration is available as an add-on called "XMLmind XML Editor Configuration Pack". Download and install it using menu item OptionsInstall Add-ons.

a:addon attributes:

location

URL of the .zip file containing the add-on.

Not required when the .xxe_addon file is itself contained in the .zip file.

Required when the .xxe_addon file is downloaded by the integrated add-on manager in order to show to the user all available add-ons. In such case, location must point to the .zip file.

a:addon elements:

a:category

Required. The category of the add-on. Contains one of the following elements: a:translation, a:dictionary, a:configuration, a:foProcessorPlugin, a:imageToolkitPlugin, a:virtualDrivePlugin or a:otherCategory.

a:otherCategory has a required name attribute (a few words at most).

a:name

Required. The name of the add-on (a few words at most).

a:version

Required. Version number of the add-on. Examples: 1, 1.0, 1.2.1, 2.1.0_05, 1.0.0-alpha1, 2.0.1-beta02.

a:requires

Specifies the name of an add-on required by this add-on. It is possible to have several a:requires elements.

"Apache FOP 1.x XSL-FO processor plug-in" example:

<a:requires>Apache Batik image toolkit plug-in</a:requires>
<a:requires>JEuclid image toolkit plug-in</a:requires>

Note that there is no need to specify indirect dependencies. When A requires B and B requires C, just specify B, and not B and C.

a:excludes

Specifies the name of an add-on which cannot be installed together with this add-on. It is possible to have several a:excludes elements.

"RenderX XEP XSL-FO processor plug-in" example:

<a:excludes>Apache FOP 1.x XSL-FO processor plug-in</a:excludes>

Note that there is no need to specify indirect dependencies. When A excludes B and B excludes C, just specify B, and not B and C.

a:author

The author of the add-on. Same content as XHTML p (a subset of XHTML in fact).

a:date

The release date of the add-on in YYYY-mm-dd ISO format[11]. Example: 2013-03-31.

a:abstract

The purpose of the add-on. Same content as XHTML p.

a:documentation

Use this element if the a:abstract is not sufficient to describe the purpose of the add-on. Same content as XHTML div.

a:xxeVersion

Specifies the version of XXE required to run this add-on. Same format as a:version, except that it may be followed by "+" to specify a version number and above.

Example: 5.2.1 means: strictly requires XXE 5.2.1. Will not work with 5.2.0, 5.2.2 or 5.3.0.

Example: 5.2+ means: requires XXE 5.2.0 and above. Works with 5.2.0, but also with 5.2.1, 5.2.2, 5.3, etc.

Without this element, the add-on is assumed to work with any version of XXE.

Important

In order to prevent link errors, any add-on which contains Java™ code (e.g. a jar) must have an a:xxeVersion equals to the version of XXE against which the code has been compiled. Of course, this a:xxeVersion must not have the "+" modifier.

Typically such add-ons are:

  • XSL-FO processor plug-ins.

  • Image toolkit plug-ins.

  • Virtual drive plug-ins.

  • Configurations, customizing XXE for a given document type, which include custom commands written in Java™.

a:platforms

Specifies the platforms required to run the add-on. Contains one of the following elements: a:windows, a:unix (means: a:mac or a:genericUnix), a:mac, a:genericUnix, a:otherPlatform.

a:otherPlatform has a required name attribute. The value of this attribute can be a plain string, for example

<a:otherPlatform name="linux" />

or a regular expression (when attribute regexp is specified with value true), for example:

<a:otherPlatform name="l[^x]+x" regexp="true" />

In both cases, the value of attribute name is matched (case-insensitive) against the value of Java™ system property "os.name" .

Without this element, the add-on is assumed to run on all platforms supported by XXE.

All platform elements may contain a a:postInstallShell child element. This element may be used to specify a script which is to be executed after the add-on has been installed.

<a:platforms>
  <a:unix>
    <a:postInstallShell>chmod a+x xep_finish_install</a:postInstallShell>
  </a:unix>

  <a:windows />
</a:platforms>

Note that the current working directory of this script is the directory where the add-on has been installed.



[11] Note that the CSS style sheet for XXE add-ons allows to specify the date using a more convenient format.