Finally, we can release the plug-in framework wisdompluginframework designed for collecting the essence of osgi in Delphi.

Source: Internet
Author: User

This is a plug-in framework implemented by Delphi,
I spent quite a lot of energy designing her. Although only the light of my meager wisdom flashed, I decided to name her with wisdom,
Because it is unique to me, after more than a year, I can still look back at my work that is quite satisfactory,
So I added a demo and management tool that showed her features and decided to release her open-source to the Delphi fans that are still sticking to it.

 

I found that the older a person is, the more afraid of complicated things, the more he prefers clear, simple, and clear things. Therefore, the design of this plug-in framework is very complicated,
In order to scan a few eyes for a few minutes, you will probably understand the principle and be able to use it manually; in order to use it, you only need to abide by the minimum usage rules!
To this end, I extracted and extracted the essence of osgi and Eclipse plug-in design, thought, thought, and finally got what I wanted, and finally merged into her!

Now that you are addicted to bragging and blowing your head, let's go back to things and introduce the features and benefits of this framework to attract you.
1. She is a microkernel Design
What is a microkernel? The core implementation is as small as an atom, and everything else is a plug-in, which builds a huge world through mutual organization of plug-ins.
Correspondingly, those who have built the basic framework and provided you with a bunch of established interfaces to let you complete the details called the giant kernel design. I hate to learn a bunch of interfaces, therefore, we firmly support the microkernel design,
The core code of the implementation in the microkernel may be within 2000 lines. For the experts, they have read the core code in three axes. Although the code is small, it is flexible and powerful.
The giant kernel is called a cement engineer, and outside the micro kernel, it is your free and unrestrained inspiration, and you are the builder of the world.

2. The concept of extension points allows unlimited extension of plug-ins
When each plug-in realizes its own dream, it can leave a space for others to realize its dream. This space is an extension point, and each plug-in can declare the extension space to other plug-ins,
Any other plug-in can achieve this expansion point, just like a plug with a reserved plug port, the plug and plug can be plugged in and connected to each other to form a tree to achieve unlimited expansion,
From any plug-in perspective, any other plug-ins are flat. Just like people, you can deal with anyone you see without a Introducer.
The concept of extension points is one of the essence of Eclipse's design. Through extension points, you can make your interface as flexible as Eclipse.

3. She only uses pure dll as the plug-in (of course, BPL is also available, I think it is just a hook)
The BPL under Delphi is really good, but you must be teeth and teeth to maintain a BPL compilation environment and control at that time. I think so too, so I firmly support pure DLL.

4. She can support the DLL generated by other compilers except Delphi.
It is a pity that VC ++ has so many excellent libraries, so it supports the DLL compiled by it! What should I do if I still cannot support it? Such as easy language? Well, I also thought about it,
Just now I have compared the micro-kernel to an atom. As we all know, the atom can be further subdivided into electronics, So what in the micro-kernel can be further subdivided and replaced! I have a DLL loader in the kernel,
You just need to redefine a loader for a special DLL and you will be able to run it. You can see if it is a bit eager to try.

5. She can dynamically update/replace the New DLL plug-in without restarting.
This function is quite useful on a server that cannot be stopped, right? It sounds very high, right? In fact, the implementation is very simple. You only need to follow one rule, that is, she told you to release it.
You must immediately accept an interface and immediately follow what she said. Of course, she will immediately send you the service interface you need.

6. Plug-ins are loaded lazily to minimize resource usage
The plug-in Framework provides three methods for loading plug-ins: Always, on-demand, and automatic management. You don't need to leave plug-ins on the disk, so that she can keep her slim and beautiful figure running fast and efficient.
In this way, if the plug-in is found to be useless for a period of time, the plug-in will be detached from the memory. Wow, this function is good! Sorry, I didn't do it. It's not lazy, because I think
This can be included in the field where external plug-ins are involved, not the atomic category, to ensure that the micro-kernel is actually micro-ha.

7. Manual or configuration is up to you
Provides a full set of APIS for you to manually obtain, manage, and uninstall plug-in DLL in the program. Of course, it also provides an xml configuration method to automatically manage plug-ins. Otherwise, A small program also needs to be configured with an XML file.

8. It may run in Linux
I only use the language features of D7. Therefore, Lazarus can be used for minor changes, but I am a Linux cainiao and have no say, so I can only say that it is possible.

I feel like I boast of the whole article... Alas, do you have the courage to blow up the strong gentleman.

 

Then let's talk about how to use it. It's quite easy:
1. decompress the package to directory A. In the Delphi environment, tools --> environment options, open the library tag, and include the core directory in the source code in the browsing path and library path.
2. Create a project. In the uses under project --> View Source, first Add "wisdomframework" and add twisdomframework. Run to start the project.
3. Where you need to call the framework interface, uses the interface description file, where "wisdomcoreinterfaceford" is used for Delphi, and the header file for C ++ is in the demo cplus.
Here is a rule: if the interface elements in the DLL are displayed in the host main window, you must call twisdomframework. Stop in onclose or destroy of the main window.

For specific features, see the demo.

 

Finally, let's talk about the design concept of this framework. This only requires a picture, as shown below:

 

 

Where can I download it? I put it on the Delphi box. Please give me a few matches. Can you please read them and give them instructions!
Thanks:
Thanks to Feihong. If he hadn't asked me for help from time to time, I guess this work has not been completed yet. If he hadn't made some suggestions, it may still be a rough pity.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.