Jump to: navigation, search

Difference between revisions of "HowTo:Create UBIK Module"


(Created page with "{{UBIK}} Modules are loaded dynamically into the {{UBIK}} Kernel by the {{UBIK}} Injection Management based on the [https://msdn.microsoft.com/de-de/l...")
 
 
(5 intermediate revisions by 3 users not shown)
Line 12: Line 12:
 
The module must implement the <code>UBIK.Injection.IUbikModule</code> interface and has to be registered for MEF composition by defining the export contract via an attribute.
 
The module must implement the <code>UBIK.Injection.IUbikModule</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.IUbikModule))]
+
     [Export(typeof(UBIK.Injection.IUbikPlugin))]
  
 
     public class TestModule : UBIK.Injection.IUbikModule
 
     public class TestModule : UBIK.Injection.IUbikModule
Line 18: Line 18:
 
     }
 
     }
 
</source>
 
</source>
 +
 +
  
 
=== Interface: IUbikInjectionMetaData ===
 
=== Interface: IUbikInjectionMetaData ===
Line 69: Line 71:
 
     [Export(typeof(UBIK.Injection.IUbikModule))]
 
     [Export(typeof(UBIK.Injection.IUbikModule))]
 
     [ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
 
     [ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
     [ExportMetadata("Type", typeof(TestPlugin))]
+
     [ExportMetadata("Type", typeof(TestModule))]
 
     [ExportMetadata("Name", "TestModule" )]
 
     [ExportMetadata("Name", "TestModule" )]
 
     [ExportMetadata("Description", "Tests the injection management")]
 
     [ExportMetadata("Description", "Tests the injection management")]
Line 80: Line 82:
 
     public class TestModule : UBIK.Injection.IUbikModule
 
     public class TestModule : UBIK.Injection.IUbikModule
 
     {
 
     {
 +
        public ISystemDefinitionProvider SystemDefinitionsProvider
 +
        {
 +
            get
 +
            {
 +
                return TestSysDefProvider.Instance;
 +
            }
 +
        }
  
 +
        public void Initialize(UBIKEnvironment environment)
 +
        {
 +
        }
 +
 +
        public bool Initialized()
 +
        {
 +
            return true;
 +
        }
 +
 +
        public void Terminate()
 +
        {
 +
        }
 +
 +
        public List<ModuleInfo> DependencyModules
 +
        {
 +
            get;
 +
        } = new List<ModuleInfo>()
 +
        {
 +
            new ModuleInfo()
 +
            {
 +
                ID = Guid.Parse("A4FF45D7-20C7-451A-A58A-1001B5B1EA7B"),
 +
                Name = "MRO Plugin"
 +
            }
 +
        }
 
     }
 
     }
 
</source>
 
</source>
 +
 +
==== To be implemented for IUbikModule ====
 +
{| class="wikitable" | width = "100%"
 +
|-
 +
! Name !! Description
 +
|-
 +
| SystemDefinitionsProvider || The instance of the SystemDefinitions for the respective module is provided.
 +
|-
 +
| Initialize || Initializes the module.
 +
|-
 +
| Initialized || Returns true when the plugin is initialized
 +
|-
 +
| Terminate || Terminates the UBIKEnvironment if it has been initialized.
 +
|-
 +
| DependencyModules || Returns the module information for which it has a dependency.
 +
|-
 +
|}
  
 
<headertabs />
 
<headertabs />
Line 88: Line 138:
 
== See also ==
 
== See also ==
 
* [[Injection_Management]]
 
* [[Injection_Management]]
 +
 +
[[Category:Injecting|Create UBIK Module]]

Latest revision as of 15:02, 7 October 2024

UBIK® Modules 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: IUbikModule

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

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

    public class TestModule : UBIK.Injection.IUbikModule
    {
    }


Interface: IUbikInjectionMetaData

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

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

Mandatory information

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

Optional information

Name Type Description
Name String Name of the module (for UI Presentation)
Description String Descrirption of the module (for UI Presentation)
Version Integer Version of the module. As there are more modules with the same ID, only the module with the highest Version is available.
TargetApplication PluginTargetApplication Possibility to limit the module 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.IUbikModule))]
    [ExportMetadata("ID", "C149402E-BC86-46D6-8D1B-63C86894EA77")]
    [ExportMetadata("Type", typeof(TestModule))]
    [ExportMetadata("Name", "TestModule" )]
    [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 TestModule : UBIK.Injection.IUbikModule
    {
        public ISystemDefinitionProvider SystemDefinitionsProvider
        {
            get
            {
                return TestSysDefProvider.Instance;
            }
        }

        public void Initialize(UBIKEnvironment environment)
        {
        }

        public bool Initialized()
        {
            return true;
        }

        public void Terminate()
        {
        }

        public List<ModuleInfo> DependencyModules
        {
            get;
        } = new List<ModuleInfo>()
        {
            new ModuleInfo()
            {
                ID = Guid.Parse("A4FF45D7-20C7-451A-A58A-1001B5B1EA7B"),
                Name = "MRO Plugin"
            }
        }
    }

To be implemented for IUbikModule

Name Description
SystemDefinitionsProvider The instance of the SystemDefinitions for the respective module is provided.
Initialize Initializes the module.
Initialized Returns true when the plugin is initialized
Terminate Terminates the UBIKEnvironment if it has been initialized.
DependencyModules Returns the module information for which it has a dependency.

See also