SciJava Common

Revision as of 22:38, 4 November 2014 by Rueden (talk | contribs) (Initial version of plugin framework & application container stuff. Still needs much fleshed out. Migrated partially from http://developer.imagej.net/service-architecture)

SciJava Common is a common library for SciJava software. It provides a plugin framework, with an extensible mechanism for service discovery, backed by its own annotation processor, so that plugins can be loaded dynamically. It is used by both ImageJ and SCIFIO.

Plugin framework

First and foremost, SciJava Common is a plugin framework—a base for developing highly modular and extensible Java applications.

Plugin discovery

All plugins available on Java's classpath are automatically discovered and made available. This is accomplished by scanning classpath resources for the file path META-INF/json/org.scijava.plugin.Plugin. Such files are generated at compile time by a Java annotation processor that writes them in response to @Plugin annotations on Java classes, an idea inspired by the SezPoz project.

Application container

All program state, such as available plugins, is accessible from a root object known as the application context.

Services

Template:Sidebox ImageJ encapsulates its various parts as separate "services" that provide related state functionality and track related program state. An instance of the ImageJ class is nothing more than a collection of these services; this instance is referred to as the "application gateway." Services are defined as interfaces, with concrete implementations as plugins. This design provides seams in the right places so that behavior at every level can be customized and overridden.

SciJava services

Here are a few of SciJava Common's major core services:

  • AppService - Tracks software applications (SCIFIO, ImageJ, etc.) present in the context.
  • DisplayService - Tracks available displays, as well as the active display, and provides the means to create new displays to visualize data.
  • EventService - Publishes events to the event bus, and allows interested parties to subscribe to them. The service provides the central means of communication between various parts of the codebase.
  • IOService - General tools for opening and saving data within the context.
  • MenuService - Builds the application menu structure.
  • ModuleService - Tracks available modules, and provides the infrastructure for executing them.
  • ObjectService - Tracks available objects of various types, including Datasets and Displays.
  • OptionsService - Tools for managing program settings.
  • PlatformService - Provides hooks for extending the application's behavior depending on the deployment platform (operating system, version of Java, etc.).
  • PluginService - Tracks available plugins, and provides the infrastructure for executing them (using the ModuleService).
  • StatusService - Publishes status updates for ongoing operations.
  • ThreadService - Manages multithreading.
  • ToolService - Tracks available tools—logic binding user input to behavior—as well as the active tool (selected on the toolbar).
  • UIService - Discovers and launches a user interface for interacting with ImageJ.

ImageJ services

Some of the services which ImageJ adds:

SCIFIO services

SCIFIO provides several additional services—in particular:

See also