Hydra Overview (Delphi)

This is an Article about Hydra for Delphi
This article will show you how to easily create modular client and server applications using the most flexible and elegant plugin framework available today.
Hydra allows you to partition applications into an executable host and an arbitrary number of DLL modules that can be loaded and unloaded at runtime. This allows for systems that are easier to update and have an overall better design, and makes it easier to distribute tasks among several developers.
Contents |
Hydra projects
A Hydra project starts with a host executable that loads DLLs using a Module Manager component. Once the DLL is loaded, the host can access the plugins contained in it. Each DLL is called a "Hydra Module" and is composed of a global Module Controller and a variable number of visual, non-visual and service plugins.
Hydra Module Manager
This component is usually dropped on the main form or main data module of your host executable and contains a variety of methods to facilitate the loading of DLLs and the creation of plugins. It contains a complete set of events to give you full control over every action.
Delphi:
.Net:
Hydra Module Controller
The Hydra Module Controller is a specialized data module contained in each Hydra Module. It acts as a broker between hosts and plugins and is instantiated only once in each DLL.
Delphi:
.Net:
Hydra Plugins
Hydra plugins can be of 3 types:
- 1. Visual plugins: Visual forms that are created on demand and can be docked to panels, etc. This type of plugin allows you to create applications like Microsoft Outlook or Lotus Notes. You can read more about visual plugins in the Hydra Visual Plugins - Step By Step article.
Screenshot from the SimpleVisual sample that is shipped with Hydra.
Screenshot from the MixedMode sample that is shipped with Hydra.
- 2. Non-visual plugins: Invisible classes that perform background tasks that usually don't require the user's interaction. This type of plugin is conceptually similar to what NT services are to Windows. You can read more about non-visual plugins in the Hydra Non-Visual Plugins article.
Screenshot from the SimpleNonVisual sample that is shipped with Hydra.
- 3. Service plugins: Standalone and full blown RemObjects Services that can be loaded on demand. Through Hydra, you can build complete servers that include RODL information, which is then dynamically merged at runtime with the information coming from the host application and other service plugins. Using this feature, you can create application servers that can be incrementally updated and can offer more or less functionality according to your licensing scheme. You can read more about service plugins in the RemObjects SDK Plugins article.
Screenshot from the RemObjects SDK Services sample that is shipped with Hydra.
Interface Based Communication
The majority of plugin frameworks available use a message-based approach to perform communication between hosts and plugins. This means that the host sends an integer ID, in addition to other parameters, and the plugin performs actions after evaluating the ID in a big case statement.
In contrast, Hydra's approach is completely object-oriented and takes advantage of one of the greatest features of modern OO languages: interfaces. You can expand plugins by adding support for custom interfaces and access them as simply as:
(fMyPlugin as IMyCustomInterface).DoSomethingNew('ABC',1,2,3);
Or, from a plugin perspective, you can access the main host as:
(Host as IMyHostExtendedInterface).DoAnotherThing(3,2,1, 'XYZ');
Hydra Module Explorer
While developing, there's often the need to check if plugin modules match a certain version or work on a customer's machine. In some other cases, it would be just nice to be able to "explore" a plugin module and see what it contains. Hydra comes with a sample project called Module Explorer which allows you to do exactly this: open Hydra modules and see what they contain. It also allows you to test the visual and non-visual plugins on the fly, without the need to build a full host.
Here are some screenshots:
The Module Explorer is also RemObjects SDK friendly and displays the RODL meta data contained in the DLL and its documentation.
Requirements
Hydra Server requires the RemObjects SDK.
Other Articles
Product Articles — Data Abstract — RemObjects SDK
Glossary — Architecture — Articles — Library — Samples













