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.
SecondoExtension.xml.
For the PointSequenceAlgebra which is part of a Secondo distribution, the file has the
following content:
...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:
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 theviewer directory of Secondo's Javagui. The procedure is
similar to the one creating an algebra plugin:
- copy all required files into a new directory
- create a
copyright.txtfile - create an XML file
- compress all the stuff to a plugin
SVGViewer is given:
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:
- file: name of the library file
- location: install path relatively to the library path of the Javagui
- provided: (yes/no) specifies whether the library must be already installed or is included in the plugin
- classpath: (true/false): specifies whether this library must be part of the classpath when compiling or starting javagui or not
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 thealgebra 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.
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:NameAll 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:
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.