SECONDO

Secondo Plugin Creation

On this page, we describe, how you can build your own plugin. If you share your work with other researchers, feel free to send us your implementation as a plugin by email (secondo@fernuni-hagen.de). We will publish it on our website.

Currently, creating a plugin needs some manual work. There is no tool supporting the creation of a plugin. Although a plugin may contain several extensions, i.e. a new algebra and display classes for the new introduced types, the following sections describe how to create a single extension plugin.

Creating an Algebra Plugin

First of all, the algebra must be created. If the algebra works fine, a plugin can be created from it. We create a new folder outside the Secondo-installation. After that, we copy all source files into this directory (including makefile, example file, and spec file). In the same directory, we create a new file copyright.txt containing copyright information about this plugin.

Furthermore, we create a new file named SecondoExtension.xml. For the PointSequenceAlgebra which is part of a Secondo distribution, the file has the following content:
Within a single plugin, only one algebra module is allowed. In the algebra section, the name of the algebra must be provided. Additionally, some dependencies can be listed. The Secondo version is necessary, other dependencies are optionally. All algebra modules used by the new algebra should be listed as an algebra dependency. You can find out the needed algebras by looking at the ...dep file created during compiling Secondo. If there are dependencies to external libraries, these must also be written within the Dependencies section. For example, if the gsl library is required by the algebra, the following code must be part of the Dependencies section:
If such information is contained in the xml file, an information about required libraries are printed out during the plugin installation and the needed entries are inserted into the file makefile.algebras. The section SourceCode has to contain all files which must be copied into the algebra directory except the example file and the spec file. The SpecFile and the ExampleFile sections contain the filenames of the corresponding files. The content of the file from the Copyright section will be displayed after the installation of the plugin. After creating the XML-file, just use the zip tool to compress all files into a single zip file. The command is:
   zip plugin.zip *

Creating a Viewer Plugin

Normally, a viewer consists of several source files and may have dependencies to external libraries. The main class of a viewer must be located within the viewer directory of Secondo's Javagui. The procedure is similar to the one creating an algebra plugin: The interesting thing is the format of the XML file. Here, an example for the SVGViewer is given:
Within the Dependencies section, the minimum required Secondo version must be specified. Furthermore, the required Java version is given. If there are dependencies to external libraries, they must be listed here. The attributes of a library entry are: If there are dependencies to other viewers, these can also be given here. The Mainclass entry contains the name of the viewer class. This file is extracted from the zip-file into the Javagui's viewer directory. If the viewer has more than one source file, these files are given in the Files section. Besides the filename, the directory of the file relatively to the viewer directory is provided using the location attribute.

Creating a Plugin Providing Display Classes

The HoeseViewer can be extended by display classes. Such a class is located within the algebra directory of the HoeseViewer and may use some supporting classes within a subdirectory of the algebra directory. Within a single plugin, several displayclasses may be contained. Again, all required files are copied into an empty directory and zipped together with an XML file. In the following, the code of the XML-file for a plugin providing display classes for periodic moving object is shown.
Supporting files are given in one of the HoeseExtension sections. Its sufficient to write them down once. The given location is the directory relatively to the algebra directory of the HoeseViewer. Similar it's enough to give the dependencies for a single display class. The remainder of this file should be self-explanatory.

Plugin Creation for Optimizer Extensions

In optimizer extensions, new files are very rare. The main task is to modify existing files. The problem is, that an append-only fashion is not sufficient because the used environment (Prolog) requires some order of the rules to create the results in the correct order. For this reason, the complete source code of the optimizer framework is tagged with tag formatted as follows:
  % Section:Start:Name
  % Section:End:Name
All extension code must be inserted between existing tags. If some code is outside such blocks, it cannot be converted into a plugin. If the extension needs additional files, copy them into an empty directory. Create the copyright file and an XML-file. The XML-file for an optimizer extension has the following structure:
Within in Dependencies section only the Secondo version is supported. The Copyright section and the File section are the same as for other plugins. Files are copyied into a directory given as location attribute relatively to the Optimizer directory of Secondo. Code snippets which should be inserted into existing files are listed as Blocks. The attribute file is the name of the file to modify (within the Optimizer directory). The section attribute specifies the name of the section where the code should be inserted. The attribute position describes whether the code should be inserted at the start of the section (first) or at the end of the section (last), respectively. This is only important if several extensions are installed.

Back to the Plugin page

Last Changed: 2009-08-18