Personal tools
gvSIG Desktop
gvSIG Desktop

Cached time 11/21/13 11:24:39 Clear cache and reload

 
Document Actions

Andami Plugins Framework

by Mario Ignacio Fèvre last modified 2012-03-12 15:32

The Andami framework is used to compose the gvSIG application. It provides mainly two types of services, the management and loading of plugins, and the management of windows that make up the user interface.

At this point we will focus briefly on the management of plugins. Andami provides a launcher for the application that initializes the plugins system, and is responsible for loading the plugins that are installed in the application. A plugin is a functional unit that can provide:

  • Menu options to install the application
  • New buttons and toolbars
  • New data providers
  • New document types

Normally in a gvSIG installation you will find a folder gvSIG/extensions. This folder contains the different plugins installed in the application. Each plugin is contained in a folder, which always contains the files:

  • Config.xml, which describes:

    • Where to find this plugin's classes

      Tip

      More information on the structure and different labels that are allowed in this file can be found at config.xml file

    • Whether this plugin depends on some other plugin

    • What menu options the plugin added to the application

    • What toolbars and buttons the plugin added.

  • Package.info, which reports on the version, name, ID or description of the plugin. It is like a container for the plugin's metadata, and allows us to identify the plugin when updating or reinstalling it.

There is also a theme folder, which contains the configuration of the application's splash, window icons and background colors.

Although the mechanism for adding new functionality to gvSIG is also adding new plugins, these in turn contain one or more extensions that provide the functionality being added. So we will have a plugin containing extensions.

With respect to the management of plugins, the main components are:

  • PluginsLocator, which provides access to the plugins manager through a static getManager method.
  • PluginsManager, which provides methods to interrogate which plugins are loaded and what extension each of them has.
  • The PluginsServices class that represents an instance of a given plugin.
  • The IExtension interface that represents an action or block of actions to incorporate into gvSIG.
  • The ExclusiveUIExtension interface that allows us to control the visibility of all the extensions loaded into the application.

We will examine the IExtension interface in more detail. This is the interface that we implement in order to add a new button or menu option. In this interface we find the methods:

  • Initialize. Executed when loading the extension and initialising the plugin. Keep in mind that when you invoke this method it is possible that not all the gvSIG extensions will have been loaded and initialized. Normally here we will initialise the components of our extension that are used by other extensions.
  • postInitilize. Invoked in the indexing of the extension. Just after having invoked the initialize method of all the gvSIG extensions. Normally, here we will perform the initialisation of our extension's components that require other extensions.
  • terminate. Invoked when gvSIG needs to release the extension. Normally this will occur when the application is closed. Here we ensure that the system resources reserved for our extension are released.
  • execute. This method is executed every time the user interacts with the menu or toolbar button associated with the extension. Normally this will implement the execution of our functionality.
  • isEnable. Invoked when you need to know if the user interface associated with the extension (buttons or menu items) is enabled.
  • isVisible. Is invoked when you need to know if the user interface associated with the extension (buttons or menu options) is visible.

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: