Ticket #993 (closed enhancement: fixed)

Opened 8 years ago

Last modified 7 years ago

Encapsulate discovery mechanism

Reported by: curtis Owned by: curtis
Priority: minor Milestone: imagej2-b4-plugins
Component: Plugin Framework Version:
Severity: serious Keywords:
Cc: Blocked By: #997, #1376
Blocking: #1052

Description (last modified by curtis) (diff)

In ImageJ2 we have taken pains to encapsulate certain dependencies, in case we decide to change them out later. In particular, the event bus is very useful, but we do not want third party code to need to add the eventbus JAR file as a direct dependency, nor import org.bushe.swing.event.*; or similar. Instead, third party code should depend only on the ImageJ event mechanism (i.e., import imagej.event.*;) in order to work with events.

Similarly, we should encapsulate the SezPoz dependency such that external modules do not need to add the sezpoz JAR as a direct dependency. Instead, ij-core and/or ij-ext should provide the means to query for available implementations of a particular interface annotated with a particular @interface.

The only case that will still require a direct import of SezPoz is if third party code wishes to define its own annotation type rather than using @Plugin or @Service. In this case, it will need to import net.java.sezpoz.Indexable; and there is essentially nothing we can do about it, since Java annotation interfaces do not support inheritance.

Change History

comment:1 Changed 8 years ago by curtis

  • Description modified (diff)

comment:2 Changed 8 years ago by curtis

In da6b2b023d5899595eda964237e83b9d331a133c, the ij-platform package (imagej.platform.Platform) uses the plugin discovery mechanism, rather than using SezPoz directly.

There are still two discoverable interfaces that use SezPoz directly:

  • imagej.ui.swing.overlay: JHotDrawOverlayAdapter + IJHotDrawOverlayAdapter
  • imagej.updater.core: Uploader + AbstractUploader

These areas of code should also use ij-ext, or else call SezPoz via the wrapper layer described above.

Last edited 8 years ago by curtis (previous) (diff)

comment:3 Changed 8 years ago by curtis

  • Blocking 1051 added

comment:4 Changed 7 years ago by curtis

  • Blocking 1052 added; 1051 removed
  • Blocked By 997 added

comment:5 Changed 7 years ago by curtis

  • Milestone changed from imagej-2.0.0-beta3 to imagej-2.0.0-beta4

comment:6 Changed 7 years ago by curtis

  • Blocked By 1376 added

comment:7 Changed 7 years ago by curtis

In 5b252ec6, the @Service annotation has been eliminated in favor of a subclass of IPlugin.

The only cases remaining to be solved now are JHotDrawOverlayAdapter (ticket #997) and Uploader (ticket #1376). Once those tickets are closed, this one can be closed too, because all SezPoz-specific logic will dwell in the DefaultPluginFinder and Plugin annotation interface.

comment:8 Changed 7 years ago by curtis

  • Status changed from new to accepted

comment:9 Changed 7 years ago by curtis

  • Status changed from accepted to closed
  • Resolution set to fixed

And now, nothing in ImageJ2 uses SezPoz directly except for the plugin mechanism itself. All extension points are plugins. This will be much easier to explain conceptually to developers and users alike! And creation additional extension points (i.e., types of plugins) for ImageJ is quite easy, and does not require direct usage of SezPoz!

Note: See TracTickets for help on using tickets.