Jump to: navigation, search

Difference between revisions of "HowTo:Create UBIK Plugin"


(Interface UBIK.Injection.IUbikPlugin)
m
 
(27 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{UBIK}} Plugins are dynamically loaded into the {{UBIK}} Kernel using the [https://msdn.microsoft.com/de-de/library/dd460648%28v=vs.110%29.aspx Microsoft Extensibility Framework (MEF)].
+
{{UBIK}} Plugins are loaded dynamically into the {{UBIK}} Kernel by the {{UBIK}} [[Injection_Management|Injection Management]] based on the [https://msdn.microsoft.com/de-de/library/dd460648%28v=vs.110%29.aspx Microsoft Extensibility Framework (MEF)].
  
== Basic Prerequisites ==
+
= Introduction =
If you want to create a plugin which can be loaded into {{UBIK}} you have to include references to
+
=== Basic Prerequisites ===
 +
Creating an own plugin requires to add references to
 
* System.ComponentModel.Composition
 
* System.ComponentModel.Composition
 
* UBIK.Injection
 
* UBIK.Injection
 +
  
 
{{UBIK}} Injection Management provides access to all the basic features used by the Kernel to identifiy and categorize the available plugins. This management is provided by a library called '''UBIK.Injection'''.
 
{{UBIK}} Injection Management provides access to all the basic features used by the Kernel to identifiy and categorize the available plugins. This management is provided by a library called '''UBIK.Injection'''.
  
== Interface: UBIK.Injection.IUbikPlugin ==
+
=== Interface: IUbikPlugin ===
The plugin must implement the '''IUbikPlugin''' interface. Additionally, the plugin has to be registered for MEF composition by defining the export contract via the attributes.
+
The plugin must implement the <code>UBIK.Injection.IUbikPlugin</code> interface and has to be registered for MEF composition by defining the export contract via an attribute.
 
<source lang="csharp">
 
<source lang="csharp">
 
     [Export(typeof(UBIK.Injection.IUbikPlugin))]
 
     [Export(typeof(UBIK.Injection.IUbikPlugin))]
     public class myPlugIn : UBIK.Injection.IUbikPlugin
+
 
 +
     public class TestPlugin : UBIK.Injection.IUbikPlugin
 
     {
 
     {
 
     }
 
     }
 
</source>
 
</source>
  
== MetaData ==
+
=== Interface: IUbikInjectionMetaData ===
Ubik needs some Meta Information to manage plugins correctly.
+
Managing plugins correctly presumes the following information, as defined by the interface <code>UBIK.Injection.IUbikInjectionMetaData</code>.
The available MetaInformation are defined by the interface UBIK.Injection.IUbikInjectionMetaData
+
  
=== Mandatory information ===
+
<source lang="csharp">
 +
    [ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
 +
    [ExportMetadata("Type", typeof(TestPlugin))]
 +
    [ExportMetadata("Name", "TestPlugin" )]
 +
    [ExportMetadata("Description", "Tests the injection management")]
 +
    [ExportMetadata("Version", 1)]
 +
    [ExportMetadata("Company", "Augmensys GmbH")]
 +
</source>
  
{| class="wikitable" | width = "50%"
+
==== Mandatory information ====
 +
{| class="wikitable" | width = "100%"
 
|-
 
|-
 
! Name !! Type !! Description
 
! Name !! Type !! Description
 
|-
 
|-
| ID|| string || Unique ID of the Plugin
+
| ID|| {{MSDN/String}} || Unique ID of the plugin
 
|-
 
|-
| Type|| System.Type || Systemtype of the Plugin. Used for filtering the Plugins during loading.
+
| Type|| System.Type || Systemtype of the plugin; used for filtering the plugins during loading.
 
|-
 
|-
 
|}
 
|}
  
 
+
==== Optional information ====
 
+
{| class="wikitable" | width = "100%"
=== Optional information ===
+
 
+
{| class="wikitable" | width = "50%"
+
 
|-
 
|-
 
! Name !! Type !! Description
 
! Name !! Type !! Description
 
|-
 
|-
| Name|| string || Name of the plugin (for UI Presentation)
+
| Name|| {{MSDN/String}} || Name of the plugin (for UI Presentation)
 
|-
 
|-
| Description|| string || Name of the plugin (for UI Presentation)
+
| Description|| {{MSDN/String}} || Name of the plugin (for UI Presentation)
 
|-
 
|-
| Version|| int || Version of the plugin. As there are more plugins with the same ID, only the plugin with the highest Version is available.
+
| Version|| {{MSDN/Int32}} || Version of the plugin. As there are more plugins with the same ID, only the plugin with the highest Version is available.
 
|-
 
|-
 
| TargetApplication|| PluginTargetApplication|| Possibility to limit the plugin for a single type of application.
 
| TargetApplication|| PluginTargetApplication|| Possibility to limit the plugin for a single type of application.
 
|-
 
|-
| MinimumKernelVersion|| string|| Minimum required Kernel version: Format x.x.x.x
+
| MinimumKernelVersion|| {{MSDN/String}} || Minimum required Kernel version: Format x.x.x.x
 
|-
 
|-
| MinimumDatabaseVersion|| string|| Minimum required Database version: Format x.x.x.x
+
| MinimumDatabaseVersion|| {{MSDN/String}} || Minimum required Database version: Format x.x.x.x
 
|-
 
|-
| Company|| string|| Information about the Company (for UI Presentation)
+
| Company|| {{MSDN/String}} || Information about the Company (for UI Presentation)
 
|-
 
|-
| Copyright|| string|| Copyright Information (for UI Presentation)
+
| Copyright|| {{MSDN/String}} || Copyright Information (for UI Presentation)
 
|-
 
|-
 
|}
 
|}
  
 
+
= Example =
Example:
+
 
+
 
<source lang="csharp">
 
<source lang="csharp">
 
 
     [Export(typeof(UBIK.Injection.IUbikPlugin))]
 
     [Export(typeof(UBIK.Injection.IUbikPlugin))]
     [ExportMetadata("ID", "23B72354-A26F-449E-A7DA-F874B4167248")]
+
     [ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
     [ExportMetadata("Type", typeof(myPlugIn))]
+
     [ExportMetadata("Type", typeof(TestPlugin))]
     [ExportMetadata("Name", "my Plugin")]
+
     [ExportMetadata("Name", "TestPlugin" )]
     [ExportMetadata("Description", "does fancy things in version 2.4")]
+
     [ExportMetadata("Description", "Tests the injection management")]
     [ExportMetadata("Version", 3)]
+
     [ExportMetadata("Version", 1)]
 
     [ExportMetadata("MinimumKernelVersion", "2.4.0.0")]
 
     [ExportMetadata("MinimumKernelVersion", "2.4.0.0")]
 
     [ExportMetadata("MinimumDatabaseVersion", "2.4.0.0")]
 
     [ExportMetadata("MinimumDatabaseVersion", "2.4.0.0")]
 
     [ExportMetadata("Company", "Augmensys GmbH")]
 
     [ExportMetadata("Company", "Augmensys GmbH")]
 
     [ExportMetadata("Copyright", "2014, Augmensys GmbH")]
 
     [ExportMetadata("Copyright", "2014, Augmensys GmbH")]
     public class myPlugIn : UBIK.Injection.IUbikPlugin
+
     public class TestPlugin : UBIK.Injection.IUbikPlugin
 
     {
 
     {
  
 
     }
 
     }
 
 
</source>
 
</source>
  
== Supported Plugin Types ==
+
<headertabs />
* [[Create_UBIK_Workflow_Activity_Plugin|UBIK Workflow Activity Plugin]].
+
 
 +
== See also ==
 +
* [[Injection_Management]]
 +
* [[HowTo:Create_UBIK_Workflow_Activity_Plugin|UBIK Workflow Activity Plugin]]
  
[[Category:Injecting]]
+
[[Category:How-To|Create UBIK Plugin]]
[[Category:How-To]]
+
[[Category:Injecting|Create UBIK Plugin]]

Latest revision as of 11:45, 3 August 2016

UBIK® Plugins are loaded dynamically into the UBIK® Kernel by the UBIK® Injection Management based on the Microsoft Extensibility Framework (MEF).

[edit]

Introduction

Basic Prerequisites

Creating an own plugin requires to add references to

  • System.ComponentModel.Composition
  • UBIK.Injection


UBIK® Injection Management provides access to all the basic features used by the Kernel to identifiy and categorize the available plugins. This management is provided by a library called UBIK.Injection.

Interface: IUbikPlugin

The plugin must implement the UBIK.Injection.IUbikPlugin interface and has to be registered for MEF composition by defining the export contract via an attribute.

    [Export(typeof(UBIK.Injection.IUbikPlugin))]

    public class TestPlugin : UBIK.Injection.IUbikPlugin
    {
    }

Interface: IUbikInjectionMetaData

Managing plugins correctly presumes the following information, as defined by the interface UBIK.Injection.IUbikInjectionMetaData.

    [ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
    [ExportMetadata("Type", typeof(TestPlugin))]
    [ExportMetadata("Name", "TestPlugin" )]
    [ExportMetadata("Description", "Tests the injection management")]
    [ExportMetadata("Version", 1)]
    [ExportMetadata("Company", "Augmensys GmbH")]

Mandatory information

Name Type Description
ID String Unique ID of the plugin
Type System.Type Systemtype of the plugin; used for filtering the plugins during loading.

Optional information

Name Type Description
Name String Name of the plugin (for UI Presentation)
Description String Name of the plugin (for UI Presentation)
Version Integer Version of the plugin. As there are more plugins with the same ID, only the plugin with the highest Version is available.
TargetApplication PluginTargetApplication Possibility to limit the plugin for a single type of application.
MinimumKernelVersion String Minimum required Kernel version: Format x.x.x.x
MinimumDatabaseVersion String Minimum required Database version: Format x.x.x.x
Company String Information about the Company (for UI Presentation)
Copyright String Copyright Information (for UI Presentation)

Example

    [Export(typeof(UBIK.Injection.IUbikPlugin))]
    [ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
    [ExportMetadata("Type", typeof(TestPlugin))]
    [ExportMetadata("Name", "TestPlugin" )]
    [ExportMetadata("Description", "Tests the injection management")]
    [ExportMetadata("Version", 1)]
    [ExportMetadata("MinimumKernelVersion", "2.4.0.0")]
    [ExportMetadata("MinimumDatabaseVersion", "2.4.0.0")]
    [ExportMetadata("Company", "Augmensys GmbH")]
    [ExportMetadata("Copyright", "2014, Augmensys GmbH")]
    public class TestPlugin : UBIK.Injection.IUbikPlugin
    {

    }

See also