Java API reference

This page covers the Fisheye/Crucible API and how you can use service interfaces that are exposed to plugins.

Fisheye/Crucible is built around Spring, an open-source component framework for for Java.

If you are familiar with Spring, then you may only wish to know that Fisheye/Crucible plugin modules (and their implementing classes) are autowired by name. Thus, if you want to access a Fisheye/Crucible component from your plugin, just include the appropriate setter method in your implementing class.

If you want to write Fisheye/Crucible plugins but are unfamiliar with Spring, the rest of this page should give you more than enough information on how to have your plugin interact with Fisheye/Crucible.

Interacting with Fisheye/Crucible

When you are writing anything but the simplest Fisheye/Crucible plugin, you will need to interact with the Fisheye/Crucible application itself in order to retrieve, change or store information. This document describes how this can be done.

Service Objects

At the core of Fisheye/Crucible is a group of "Service" objects. For example, the ReviewService facilitates the retrieval and manipulation of Crucible code reviews.

Dependency Injection

Traditionally, in a component-based system, components are retrieved from some kind of central repository. For example, in an EJB-based system, you would retrieve the bean from the application server's JNDI repository.

Fisheye/Crucible works the other way round. When a plugin module is instantiated, Fisheye/Crucible determines which components the module needs, and delivers them to it.

Fisheye/Crucible determines which components a module needs by reflecting on the module's methods. Any method with a signature that matches a standard JavaBeans-style setter of the same name as a Fisheye/Crucible component will have that component passed to it when the module is initialised.

So, if your plugin module needs to access the ReviewService, all you need to do is declare the class to your autowired constructor. For instance:

1
2
public class MyServlet extends HttpServlet {

    private final ReviewService reviewService;

    @Autowired
    public MyServlet(ReviewService reviewService) {
        this.reviewService = reviewService;
    }
}

You can also use setter injection on your plugin class:

1
2
public void setReviewService(ReviewService reviewService) {
    this.reviewService = reviewService;
}

Note that you cannot mix constructor and setter injection in the same class - if you mark a constructor with @Autowired, no setters will be used for injection.

All plugin module classes which are created by the plugin system are injected by Spring. That is, the HttpServlet subclass of a servlet plugin module, the SCMModule implementation of a Light SCM plugin module and the EventListener implementation of an event listener plugin module.

SAL - Shared Access Library

The Atlassian plugins framework comes with a set of generic modules and services that are common to all Atlassian products. These services are offered through the SAL API. Using these services is the same on all products. Consequently, a plugin that exclusively uses SAL services and nothing application-specific, will be able to run on any Atlassian product.

When developing a plugin for Fisheye/Crucible, your plugins automatically has a transitive maven dependency on a version of SAL appropriate to the version of Fisheye/Crucible that you are programming for.

Examples of services offered by SAL include:

  • Persistent storage for plugin configuration settings
  • Access to the application's license
  • Support for making network requests (including Trusted Apps)

For more information on which SAL services are supported by each Atlassian product, refer to the supported platform matrix.

Fisheye and Crucible Javadoc references:

Please refer to our complete Javadoc reference:

  • SAL - Atlassian's Shared Access Library that offers functionality common to all Atlassian products

Rate this page: