What is an add-on?
An add-on is a piece of code that plugs in a specific piece of functionality such as the ability to create a map view, to perform terrain analysis, and so on.
You can remove add-ons, customize existing add-ons, and add your own add-ons.
Each add-on is a class that extends
This class contains two abstract methods,
plugInto method is called to load the add-on and
unplugFrom to unload an add-on.
Both methods have a parameter of the type
ILcyLucyEnv, which provides a link to the Lucy back-end.
Using those methods, you add the add-on functionality to the Lucy framework.
The addons.xml file
It is the responsibility of the front-end to load the add-ons.
The default front-end that comes with Lucy,
TLcyMain, determines which add-ons to load by reading the XML file
It looks for this file in its classpath.
This same mechanism is used by all sample front-ends in the LuciadLightspeed release. The only difference is that they read a different XML file.
For example, the front-end of the map-centric Lucy sample reads the
Structure of the add-ons XML file
addons.xml file is structured with a root element
<addons> that contains an
<addon> element for each add-on.
<addon> element consists of the following elements:
<priority>: specifies the priority of the add-on. The add-on priority influences the order in which the add-ons are loaded. Add-ons with a low priority number are loaded before add-ons with a higher priority number. The priority is defined through an integer or a specific string. For more information, see the Javadoc for
<name>: specifies a name for the add-on. This name can be displayed in the splash screen, for example.
<class>: refers to the add-on. This element must be the fully qualified class name of the class extending
ALcyAddOn. When Lucy loads all the add-ons specified in the XML file, the specified class is instantiated with the default constructor — the constructor without arguments. It is then configured with the configuration file specified in the <configFile> element.
<configFile>: this optional element contains the relative path to the configuration file for the add-on. The path is relative to the classpath. Normally, the
configdirectory is in the classpath, so it can be specified relative to that directory. The configuration file typically lists and documents the settings for the add-on. It may also refer to other configuration files.
<addons> element can also contain
<include> elements that specify other add-on files that must be included.
The add-ons of those included files will be inserted where the
<include> element is located.
<addon> elements in an included file are ignored if the including file also has an
<addon> element for the same add-on class.
You can use that to override settings of an included add-on.
For instance, you can include the default
addons.xml file of Lucy in your own add-on file, but specify the
ALcyPreferencesAddOn in your own file to change the default add-on configuration file.
<addons> <addon> <priority>early</priority> <name>Preferences</name> <class>com.luciad.lucy.addons.preferences.TLcyPersistentPreferencesAddOn</class> <configFile>lucy/preferences/preferences_addon.cfg</configFile> </addon> <addon> <priority>data_producer</priority> <name>Default Formats</name> <class>com.luciad.lucy.addons.decoders.TLcyDefaultDecodersAddOn</class> <configFile>lucy/decoders/default_decoders.cfg</configFile> </addon> <addon> <priority>data_consumer</priority> <name>Map</name> <class>com.luciad.lucy.addons.map.TLcyMapAddOn</class> <configFile>lucy/map/map_addon.cfg</configFile> </addon> <addon> <name>Lightspeed Previewer</name> <class>com.luciad.lucy.addons.previewer.lightspeed.TLcyLspPreviewAddOn</class> <configFile>lucy/previewer/lightspeed/TLcyLspPreviewAddOn.cfg</configFile> </addon> <addon> <priority>late</priority> <name>Workspace</name> <class>com.luciad.lucy.addons.workspace.TLcyWorkspaceAddon</class> <configFile>lucy/workspace/workspace_addon.cfg</configFile> </addon> </addons>
Customizing the add-ons used by your application
For detailed information about changing add-ons and their configuration, see: