The idea with eboxy plugins is that you can do either of two things:
The plugin framework was designed so that I could add optional features to eboxy, without adding too many features to the core eboxy codebase that won't be needed by everyone, and to make it easier for other developers to add features that they want without having to modify the eboxy codebase itself.
Currently, the plugin framework is in "alpha" stage, which means two things: (a) please let me know if you think it's been implemented well and if it does everything you need; and (b) because of this, don't be too surprised if it changes in future versions of eboxy. That said, after the next one or two versions I don't plan to change it too much - at the very least I will try not to change it in any way that breaks backwards compatibility.
Plugins are loaded by either using the loadplugin
script command
or alternatively by putting a <plugin>
element into the XML file. The
latter is the recommended method, because it is simpler and allows you to
attach event scripts to objects that the plugin registers. Here's a simple
example of loading a plugin using a <plugin>
element:
...
<page ...>
<plugin module="myplugin"/>
...
</page>
...
Note that the lifetime of your plugin is dependent upon whether you put the
<plugin>
tag inside a page or in the <system>
section.
If it is within a <page>
, it will be in memory only while the page is being
displayed. If you put it in the <system>
section (or loaded by using the
loadplugin script command) it will be loaded for as long as eboxy is running, unless the plugin
requests to be unloaded.
eboxy will look for plugins in LIBDIR/eboxy
only (where LIBDIR is
picked up at compile time, usually /usr/local/lib). Also, the .so extension is always
omitted. So in the above example, when the page is loaded eboxy will attempt to load
the plugin file /usr/local/lib/eboxy/myplugin.so
into memory (actually,
some loading and pre-initialisation is done when the XML file is read in, and the
plugin is fully initialised when the page is loaded).