Plugin Architecture Tutorial

I am looking for a tutorial on how to create a plug-in system, preferably in Java, but I cannot find any general examples in google (they all relate to creating plug-ins) - can anyone explain or relate how to achieve this ?

+4
source share
2 answers

A plug-in system, in it the core usually consists of two things.

1) The interface or set of interfaces that the plugin must implement in order for the underlying system to use them.

2) A custom class loader, which the main system implements to load plug-ins, which are usually packaged as banks.

The main system creates a class loader based on some predefined directory or configuration file that indicates where the plugins exist. This loader iterates through the classes and finds those that implement the specified interface, and calls methods based on this interface, depending on the system.

+2
source

Why don't you use something that is already there, Equinox , or take one more step and use the Eclipse plug-in system.

+2
source

Source: https://habr.com/ru/post/1344916/


All Articles