Open Enet4 opened 9 years ago
Sounds like a very cool idea. I think it will help a lot to develop the plugins, especially new developers. Can't wait to use :)
Nice improvement to PluginBase: https://github.com/bioinformatics-ua/dicoogle/blob/dev/sdk/src/main/java/pt/ua/dicoogle/sdk/PluginBase.java
We will analyse and discuss it in a meeting after release 2.0.
Good job.
Yes, good thing you've reminded me of PluginBase. I've updated the proposal to make it clear that both PluginSet
and PluginBase
become obsolete.
I have revised the proposal again in order to fix another flaw. We cannot load plugins if they do not implement a Plugin
interface.
I have updated the proposal. After some rethinking, I figured that plugin-scoped resources still make sense.
While these ideas are interesting, it is too late for something like this to enter v3. Maybe Dicoogle 4? :)
These are a few ideas that I had some months ago. They will not be too complicated to implement and will certainly make plugins look cleaner, safer and easier to develop. I am leaving the details below so that it can be considered for integration in the future.
The plugin set is meant to be an aggregation of the plugins that we which to inject to the system, and right now it feels occluded by a multitude of methods that need to be implemented before things work. We can give our developers the confidence that they are in charge of their plugins while keeping things simple.
Proposal: Make the development of a plugin set based on annotations rather than implementing an interface.
The key concept here is that instead of having plugin getters (one method per interface type), the plugins will be declared as non-static attributes of the plugin set class. New annotations can be used to retrieve these instances, as well as to identify the plugin set. Only the default constructor and the shutdown event method (renamed here to
onShutdown
) will be required. If we move to Java 8 later on,onShutdown
may become a default method with an empty implementation.@DicooglePluginSetName(String value)
should extend jspf's@PluginImplementation
and is also used to define the name of the plugin set (getName
is discarded). Then we can have one annotation for each kind of interface (@QueryPlugin
,@IndexerPlugin
,@StoragePlugin
,@ServletPlugin
,@RestletPlugin
, ...). The interfaceDicooglePluginSet
will still extend jspf'sPlugin
and should still be used in our plugin sets, otherwise loading the plugins may not work. No collections are created, all plugin types are optional, and thePluginBase
helper class becomes obsolete.These are the reasons why I think we should support these changes: