Chapter 2. Plugin Management

Table of Contents

Basic Concepts
The Plugin Namespace
The Plugin Manager
Plugin Loaders
Managing Plugins
Writing a Plugin
Plugins and the Filesystem
Loading and Releasing Plugins
Staying up to date

Basic Concepts

The Plugin Namespace

Yehia uses a single namespace for all applications. However, this namespace is hierarchical and thus every application or library can use a sub-namespace for its plugins.

How this works is best made clear with a real-world example. The database access library GQL, which uses Yehia, is using database drivers to provide transparent access to different relational databases. This drivers aren't compiled into the library, but implemented as plugins. The library uses the Yehia sub-namespace gql and gql.drivers for its database drivers. As you can see, the namespaces can be nested into each other to form a tree-like structure, just like the filesystem. However, Yehia uses the dot ('.') instead of the slash ('/') for seperating the plugin namespace "directories". To complete the above example, the full path of an database driver then is, for example gql.drivers.pg (this would be the PostgreSQL driver).

This way it is possible for all applications and each subsystem within an application to install their plugins without interfering with the others.

The Plugin Manager

The plugin manager is the central instance that, well, manages the plugins. It keeps track of the currently loaded and available plugins, loads and releases (unloads) plugins on request and emits signals when plugins are loaded, released, become available or unavailable.

Plugin Loaders

The plugin manager supports different types of plugins through plugin loaders. The default plugin loader is able to load shared C++ libaries. A plugin or application may register other plugin loader to implement loading of a different kind of plugins. This is used in the implementation of extension language plugin loaders that are able to load, say, a Python script as a plugin.