Interface JiraService

All Superinterfaces:
ObjectConfigurable, Runnable
All Known Subinterfaces:
JiraServiceContainer
All Known Implementing Classes:
AbstractMessageHandlingService, AbstractService, AuditLogCleaningService, CacheFlusher, ClusterMessageCleaningService, DebugService, ExportService, FileService, ImapService, IndexSnapshotService, JiraHomeReplicatorService, JiraServiceContainerImpl, MailFetcherService, MailQueueService, MockJiraServiceContainer, NodeStateCheckerService, PopService, ReferenceDebugService, ReplicatedIndexCleaningService, UnloadableJiraServiceContainer

@PublicSpi public interface JiraService extends ObjectConfigurable, Runnable
Classes that are to be run as services within JIRA must implement this interface.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Comparator<JiraService>
    Compares two given JiraService objects by their names and returns the result of the comparison.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method is called when the service is unloaded (usually when the web application or server is being shut down).
    A textual description of the service.
    A textual name of the service as entered by the user from the web interface.
    void
    init(com.opensymphony.module.propertyset.PropertySet props)
    Deprecated.
    default void
    init(com.opensymphony.module.propertyset.PropertySet props, long configurationIdentifier)
    Initialise the service passing configuration identifier which is unique per configuration of the service.
    boolean
    Indicates whether administrators can delete this service from within the web interface.
    boolean
    Whether this service class should be unique.
    void
    run()
    Perform the action of this service.
    void
    Used to set the service's name.
  • Field Details

    • NAME_COMPARATOR

      static final Comparator<JiraService> NAME_COMPARATOR
      Compares two given JiraService objects by their names and returns the result of the comparison.
  • Method Details

    • init

      @Deprecated void init(com.opensymphony.module.propertyset.PropertySet props) throws ObjectConfigurationException
      Deprecated.
      Initialise the service. This method is guaranteed to be called before the first call to run().

      As the parameters are gained from the user's interaction with the website, it is not guaranteed to be called with the correct, or indeed with any parameters.

      init() may be called multiple times during the services lifetime.

      Parameters:
      props - initialisation parameters
      Throws:
      ObjectConfigurationException - in case of an error with initialisation parameters
      See Also:
    • init

      default void init(com.opensymphony.module.propertyset.PropertySet props, long configurationIdentifier) throws ObjectConfigurationException
      Initialise the service passing configuration identifier which is unique per configuration of the service.

      As the parameters are gained from the user's interaction with the website, it is not guaranteed to be called with the correct, or indeed with any parameters.

      this method may be called multiple times during the services lifetime.

      Parameters:
      props - initialisation parameters
      configurationIdentifier - identifier of the configuration of the service
      Throws:
      ObjectConfigurationException - in case of an error with initialisation parameters
      Since:
      7.2.12
    • run

      void run()
      Perform the action of this service. The caller of this method assumes that no housekeeping has been done, and will call setLastRun() after the run() method.

      init() is guaranteed to be called before run(), but the parameters passed to init() are not guaranteed to be correct. Any parameters expected to be set by init() should be checked in this method upon each invocation.

      Specified by:
      run in interface Runnable
      See Also:
    • destroy

      void destroy()
      This method is called when the service is unloaded (usually when the web application or server is being shut down).

      You may wish to remove any connections that you have established, eg. database connections.

    • isInternal

      boolean isInternal()
      Indicates whether administrators can delete this service from within the web interface.

      Generally only Atlassian services should return true from this.

      Returns:
      true if this service is internal to JIRA, false otherwise
    • isUnique

      boolean isUnique()
      Whether this service class should be unique. Some service are fine to have multiples, and some are not.

      Having multiple backup services could be fine - perhaps you want to backup once an hour, and also once a day.

      With other services, you may wish to enforce their uniqueness

      Returns:
      Whether this service class should be unique.
    • getDescription

      String getDescription()
      A textual description of the service. You can include HTML if required, but do not use tables, or DHTML, as the description may be displayed inside tables / frames.

      A good description will describe what this service does, and then explains the parameters required for configuring the service.

      If no description is appropriate, return null.

      Returns:
      A HTML description of the service
    • getName

      String getName()
      A textual name of the service as entered by the user from the web interface.

      The name should be unique to identify services of the same class.
      This is enforced when adding new services via the web interface.

      The value of name does not effect the service, hence can be set to null

      Returns:
      The name of the service
    • setName

      void setName(String name)
      Used to set the service's name. For details on the services name see getName()
      Parameters:
      name - service name to set