How to make an app with a plugin mechanism [C # and Java]
I did some research on the title, so I posted it here as well.
However, although there was active movement (papers, articles, etc.) in the plug-in architecture around 2003, it seems that the content has not been discussed much recently.
This time, I've implemented a sample bibliography to give you a feel for how to make it.
Basic method of making
- Define interfaces (GUI, commands)
- Define how to extend the interface
- Create a plug-in or host application that implements the defined interface
Basic usage
- Make the plugin an executable file
- The host application stores the file in a specific location and uses it.
For C
- Create a dll that defines the interface
- Create a plugin with dll that implements the defined interface
- Create a host application that loads and uses plugins
For Java
- Define an interface for the plugin
- Create a plugin with jar that implements the defined interface
- In the Jar file, create a manifest file with the plugin class name.
- Create a host application that loads and uses plugins
How to implement it with something that does not have an interface such as python?
Python seems to be a specification that allows multiple inheritance without having an interface.
If you do not take care when implementing it, you will suffer from the influence of other modules ...
This is a continuation of the investigation ...
Personal impression
- When implementing in C # or Java, it is essential to define the interface including what kind of plug-in can be created.
- If you want to realize something like IDE, it seems good to refer to the interface of plugin development of Visual Studio and Eclipse.
- https://docs.microsoft.com/ja-jp/visualstudio/extensibility/starting-to-develop-visual-studio-extensions?view=vs-2017
- https://gihyo.jp/dev/serial/01/eclipse-plugin/0001
- Although not described, it seems to be implemented using multiple inheritance in languages such as Python that do not have an interface.
- For desktop apps, the basic GUI configuration and design hasn't changed as far as Visual Studio and Eclipse examples are concerned.
- Has a mechanism to define extensions for each
- Menu / Toolbar / Tool window
[See here for the same content and code (mainly here)]
https://github.com/dandan611/SampleOfPluginSoftware
References
- Start developing Visual Studio extensions
- https://docs.microsoft.com/ja-jp/visualstudio/extensibility/starting-to-develop-visual-studio-extensions?view=vs-2017
- Introduction to plug-in development 1st Development basics Learn the basics of Eclipse plug-in development
- https://www.ibm.com/developerworks/jp/opensource/library/os-eclipse-plugindev1/index.html
- Creating a text editor with .NET plugin functionality
- https://codezine.jp/article/detail/1
- Create a Java program that can be extended with plugins
- https://codezine.jp/article/detail/1271
- What is OSGi, the basic technology used in Eclipse and Spring?
- https://www.atmarkit.co.jp/fjava/special/osgi/osgi_1.html
- Writing Plugin-Based Applications
- https://www.developerfusion.com/article/4371/writing-pluginbased-applications/
Plugin architecture
https://decomo.info/wiki/translation/adc/cocoa/foundation/introduction_to_dynamically_loading_code/0600_plugins