NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #993 (closed enhancement: fixed)

Opened 2012-02-22T13:43:14-06:00

Last modified 2012-08-13T15:54:15-05:00

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)

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 2012-02-22T13:44:35-06:00 by curtis

  • Description modified

comment:2 Changed 2012-03-21T15:06:36-05:00 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 2012-03-21T15:07:07-05:00 by curtis

comment:3 Changed 2012-05-14T15:58:21-05:00 by curtis

  • Blocking 1051 added

comment:4 Changed 2012-07-10T17:39:24-05:00 by curtis

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

comment:5 Changed 2012-07-11T11:39:58-05:00 by curtis

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

comment:6 Changed 2012-08-07T14:43:58-05:00 by curtis

  • Blocked By 1376 added

comment:7 Changed 2012-08-07T14:45:08-05:00 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 2012-08-09T17:13:00-05:00 by curtis

  • Status changed from new to accepted

comment:9 Changed 2012-08-13T15:54:15-05:00 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!