Skip to content

Commit 7b67970

Browse files
committed
Make Gateway into a type of Plugin
This allows available Gateways to be discovered at runtime, which can be useful for some purposes. For example, the Script Editor will use this mechanism in the future to register shortcut aliases for the Gateways, so that you can write: // @imagej ij Instead of needing to write out the FQCN: // @imagej.ImageJ ij
1 parent fa79ff9 commit 7b67970

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/main/java/org/scijava/AbstractGateway.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.scijava.event.EventService;
4040
import org.scijava.log.LogService;
4141
import org.scijava.object.ObjectService;
42+
import org.scijava.plugin.AbstractRichPlugin;
4243
import org.scijava.plugin.PluginService;
4344
import org.scijava.service.Service;
4445
import org.scijava.thread.ThreadService;
@@ -49,7 +50,7 @@
4950
* @author Mark Hiner
5051
* @author Curtis Rueden
5152
*/
52-
public abstract class AbstractGateway extends AbstractContextual implements
53+
public abstract class AbstractGateway extends AbstractRichPlugin implements
5354
Gateway
5455
{
5556

src/main/java/org/scijava/Gateway.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
import org.scijava.event.EventService;
3939
import org.scijava.log.LogService;
4040
import org.scijava.object.ObjectService;
41+
import org.scijava.plugin.Plugin;
4142
import org.scijava.plugin.PluginService;
43+
import org.scijava.plugin.RichPlugin;
4244
import org.scijava.service.Service;
4345
import org.scijava.thread.ThreadService;
4446

@@ -86,12 +88,19 @@
8688
* a {@link NoSuchServiceException} is thrown, which facilitates appropriate
8789
* (but optional) handling of missing services.
8890
* </p>
91+
* <p>
92+
* Gateways discoverable at runtime must implement this interface and be
93+
* annotated with @{@link Gateway} with attribute {@link Plugin#type()} =
94+
* {@link Gateway}.class. While it possible to create a gateway merely by
95+
* implementing this interface, it is encouraged to instead extend
96+
* {@link AbstractGateway}, for convenience.
97+
* </p>
8998
*
9099
* @see Context
91100
* @author Mark Hiner
92101
* @author Curtis Rueden
93102
*/
94-
public interface Gateway extends Contextual {
103+
public interface Gateway extends RichPlugin {
95104

96105
/**
97106
* Returns an implementation of the requested {@link Service}, if it exists in

0 commit comments

Comments
 (0)