com.atlassian.jira.service
Interface JiraService

All Superinterfaces:
ObjectConfigurable, Runnable
All Known Subinterfaces:
JiraServiceContainer
All Known Implementing Classes:
AbstractMessageHandlingService, AbstractService, DebugService, ExportService, FileService, ImapService, JellyService, JiraPluginSchedulerService, JiraServiceContainerImpl, MailFetcherService, MailQueueService, PopService, ReferenceDebugService, UnloadableJiraServiceContainer, VcsService

@PublicSpi
public interface JiraService
extends ObjectConfigurable, Runnable

Classes that are to be run as services within JIRA must implement this interface.


Field Summary
static Comparator<JiraService> NAME_COMPARATOR
          Compares two given JiraService objects by their names and returns the result of the comparison.
 
Method Summary
 void destroy()
          This method is called when the service is unloaded (usually when the web application or server is being shut down).
 String getDescription()
          A textual description of the service.
 String getName()
          A textual name of the service as entered by the user from the web interface.
 void init(com.opensymphony.module.propertyset.PropertySet props)
          Initialise the service.
 boolean isInternal()
          Indicates whether administrators can delete this service from within the web interface.
 boolean isUnique()
          Whether this service class should be unique.
 void run()
          Perform the action of this service.
 void setName(String name)
          Used to set the service's name.
 
Methods inherited from interface com.atlassian.configurable.ObjectConfigurable
getDefaultProperty, getKey, getLongProperty, getObjectConfiguration, getProperties, getProperty, getTextProperty, hasProperty
 

Field Detail

NAME_COMPARATOR

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

Method Detail

init

void init(com.opensymphony.module.propertyset.PropertySet props)
          throws ObjectConfigurationException
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

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:
init(com.opensymphony.module.propertyset.PropertySet)

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


Copyright © 2002-2012 Atlassian. All Rights Reserved.