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.
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.
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:
You can also use setter injection on your plugin class:
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:
- FishEye Services Classes – used to browse source repositories and committer activity
- Data Types (POJO's) – the data objects used as parameters by the FishEye Services
- Crucible Services Classes – used to search and create reviews
- Data Types (POJO's) – the data objects used as parameters by the Crucible services
Please refer to our complete Javadoc reference:
- SAL – Atlassian's Shared Access Library that offers functionality common to all Atlassian products