Neutralise
Neutralise

Reputation: 507

Plugin architecture tutorial

I am looking for a tutorial on how to create a plugin system, preferably in Java, but I can't find any generic examples on google (they are all about making plugins) - can anyone explain or link to how to achieve this?

Upvotes: 4

Views: 1426

Answers (2)

Suraj Chandran
Suraj Chandran

Reputation: 24791

Why dont use something that's already there like Equinox, or go one step further and use Eclipse plugin system.

Upvotes: 2

MeBigFatGuy
MeBigFatGuy

Reputation: 28568

A plugin system, at it's core is usually composed of two things.

1) An interface or set of interfaces that the plugin must implement so that the core system can use them.

2) A custom classloader that the main system implements to load the plugins that are usually packaged as jars.

The main system builds the classloader based on some predefined directory, or configuration file that specifies where the plugins exist. This loader iterates over the classes and finds ones that implement the specified interface, and calls methods based on that interface as appropriate for the system.

Upvotes: 1

Related Questions