WtyczkaWtyczka jest bundlem OSGi instalowanym w środowisku OSGi. Może być ona dynamicznie:
Wtyczka posiada własny kontekst, który pełni rolę kontenera komponentów wtyczki, serwisów, kontrolerów. Możliwe jest wstrzykiwanie zależności i korzystanie ze wszystkich dobrodziejstw SpringFramework. Deskryptor wtyczki (suncode-plugin.xml)Deskryptor wtyczki to plik XML który dostarcza podstawowe informacje o wtyczce oraz jest miejscem na deklaracje wykorzystywanych modułów. Plik ten jest wymagany, ponieważ dostarcza informacje o wtyczce (jej unikalny identyfikator i wyświetlaną nazwę). Deskryptor ma następującą strukturę:
Sekcja <requirements> pozwala na określenie wymaganych zależności wtyczka. Zależność systemowa <plusworfklow> powinna być zgodna co do wersji z wersją parenta określoną w pom.xml.
Wtyczka może także zdefiniować PluginHook, jeżeli potrzebne jest wywołanie akcji przy starcie i zatrzymaniu wtyczki:
Wymagania wtyczekWtyczka może zdefiniować swoje wymagania, które są sprawdzane podczas:
Wymagania dzielimy na:
Operacje na wtyczkachTen rozdział pokazuje, jak korzystać z API mechanizmu wtyczek. Rozdział Zarządzanie wtyczkami pokazuje, jak zarządzać nimi z poziomu systemu.
Głównym komponentem mechanizmu wtyczek jest PluginFramework. W systemie PlusWorkflow musimy pobrać ten obiekt z kontekstu aplikacji:
Poniżej przedstawiono wykonywanie kilku podstawowych operacji:
|
PluginThe plugin is an OSGi bundle installed in the OSGi environment. It can be used dynamically:
The plugin has its own context, which acts as a container for plugin components, services, controllers. It is possible to inject inject dependencies and use all the benefits of SpringFramework. Plugin descriptor (suncode-plugin.xml)
The plugin descriptor is an XML file that provides basic information about the plugin and is a place for declarations of the modules used. This file is required because it provides information about the plugin (its unique identifier and display name). The descriptor has the following structure:
The <requirements> section allows you to specify the required plugin dependencies. The <plusworfklow> system dependency should match as to version with the parent version specified in pom.xml.
The plugin can also define PluginHook, if an action is needed to be triggered when the plugin starts and stops:
Plugin requirementsA plugin can define its requirements, which are checked during:
Requirements are divided into:
Plugin operationsThis chapter shows how to use the plugin mechanism API. The Plugins management shows how to manage plugins from within the system.
The main component of the plugin mechanism is the PluginFramework. In PlusWorkflow, we need to retrieve this object from the application context:
The following shows the performance of some basic operations:
|