This is a C # implementation of the OSGi framework that was completed about 3-4 years ago, and the implementation of the process refers to the OSGi specification and some implementation ideas (thanks to the information and projects at the time), although only a few small projects have been used in practical applications, However, the specification implementation of OSGi is relatively complete, and includes some basic elements, because the personal Project center of gravity has shifted, now intends to open it up for your reference:
The Osgi.net framework is a modular management framework that references the OSGI specification. The framework provides a standard environment for application extensions (bundles). The entire framework can be divided into several levels:
- 1. Operating Environment
- 2. Module (Bundle)
- 3. Life Cycle Management
- 4. Service Registration
- 5. Extension Point Support
At present Osgi.net has the following characteristics:
- 1. Component pluggable: Components can be loaded and unloaded at run time according to business needs
- 2. Dynamic update of components: components can be updated at runtime to replace the current version
- 3. Version isolation of components: different versions of assemblies that reference the same product can be version isolated
- 4. Complete lifecycle of components: includes installed, mounted, activated, on, stopped, uninstalled
- 5. Load order of components: component loading to control load order by setting load levels according to business requirements
- 6. Communication support for components: the service-oriented programming model between components to achieve communication between components, the purpose of the call
- 7. Extended Support for Components: components provide extensibility points and extensions to meet the extensibility of a component
Starting a osgi.net application requires only the following code
Using system;using osgi.net.core.root;namespace consoledemo{ class program { static void Main (string[] args) { //Create frame factory var frameworkfactory = new Frameworkfactory (); Create framework kernel var framework = Frameworkfactory.createframework (); Initializes the frame framework . Init (); Start the frame framework . Start (); Console.ReadLine ();}}}
Creating a Osgi.net project requires:
1. Referencing the framework kernel assembly OSGi.NET.dll
2. Add the Framework kernel configuration file OSGi.NET.properties
3. Add Log4net.config file and Log4net.dll assembly reference if log support is required
The default file directory structure for the Osgi.net project is as follows
/program Directory
/Program Directory/bundles/
/Program Catalog/bundles/module A/
/program Directory/bundles/module A/manifest.xml
/Program Catalog/bundles/module/module A.dll
/program Directory/bundles/module a/libs/
/Program Catalog/bundles/module a/libs/*. dll
/Program Catalog/bundles/Module B/
/program Directory/bundles/module C/
/program directory/libs/(optional)
/Program Directory/osgi.net.properties
Note:
The Libs folder in the program directory holds bundles shared assemblies (you can also configure shared manifests in a configuration file), such as interface contracts, public third-party class libraries, and so on.
The Libs folder in module A holds its private assembly.
Manifest.xml the module as a program manifest file.
OSGi.NET.properties for framework kernel configuration file
About load Order:
Because of the business requirements, there is a possibility of dependencies for each module, so module loading also has the requirement of loading order, which can be set by the Startlevel property of the Manifest.xml,bundle node in the manifest file. The smaller the value, the more pre-loading.
About bundle Reference assembly search principles:
1. According to the loaded bundle reference assembly, according to the assembly name + version number matching principle, the first from the [/program directory/libs/] directory or share list search.
2. If there is no match in the first step, search from the [/program directory/bundles/module A/libs/*.dll] directory according to the assembly name and associate the bundle with the version of the found assembly.
3. Under each bundle, the Libs directory assembly is isolated from the bundle in the load, ensuring that there is no impact between the assemblies referenced by different bundles. That is, if a shared assembly exists, place the [/program directory/libs/] directory or in the shared inventory configuration.
Intro:http://www.diginfo.me/osgi-net-implement
Source Code Https://github.com/FreezeSoul/OSGi.NET
Description Document Https://github.com/FreezeSoul/OSGi.NET/blob/master/OSGi.NET%20Client/Help/Help/Documentation.chm?raw=true
The OSGi specification of C # implements open source