com.atlassian.jira.service
Class AbstractService

java.lang.Object
  extended bycom.atlassian.jira.service.AbstractService
All Implemented Interfaces:
JiraService
Direct Known Subclasses:
AbstractMessageHandlingService, DebugService, ExportService, JellyService, MailQueueService, VcsService

public abstract class AbstractService
extends java.lang.Object
implements JiraService

A convenience class - if you extend this class, all that needs to be implemented is run()


Field Summary
protected  Category log
           
protected  java.lang.String name
           
 
Constructor Summary
AbstractService()
           
 
Method Summary
 void destroy()
          This method is called when the service is unloaded (usually when the web application or server is being shut down).
 java.lang.String getDefaultProperty(java.lang.String propertyKey)
           
 java.lang.String getDescription()
          A textual description of the service.
 java.lang.Long getLongProperty(java.lang.String propertyKey)
           
protected  ObjectConfiguration getObjectConfiguration(java.lang.String id, java.lang.String xmlfile, java.util.Map params)
           
 PropertySet getProperties()
           
 java.lang.String getProperty(java.lang.String propertyKey)
           
 boolean hasProperty(java.lang.String propertyKey)
           
 void init(PropertySet props)
          Initialise the service.
 boolean isInternal()
          Indicates whether administrators can delete this service from within the web interface.
 boolean isUnique()
          By default, services are not unique.
abstract  void run()
          This method must be implemented in a subclass, and performs the functionality that the service performs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected Category log

name

protected java.lang.String name
Constructor Detail

AbstractService

public AbstractService()
Method Detail

run

public abstract void run()
This method must be implemented in a subclass, and performs the functionality that the service performs. This method is called after the duration specified through the administration web interface.

Specified by:
run in interface JiraService
See Also:
JiraService.init(PropertySet)

init

public void init(PropertySet props)
          throws ObjectConfigurationException
Description copied from interface: JiraService
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.

Specified by:
init in interface JiraService
Throws:
ObjectConfigurationException

destroy

public 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.

Specified by:
destroy in interface JiraService

isInternal

public boolean isInternal()
Description copied from interface: JiraService
Indicates whether administrators can delete this service from within the web interface.

Generally only Atlassian services should return true from this.

Specified by:
isInternal in interface JiraService

isUnique

public boolean isUnique()
By default, services are not unique.

Specified by:
isUnique in interface JiraService
Returns:
false.

getDescription

public java.lang.String getDescription()
Description copied from interface: JiraService
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.

Specified by:
getDescription in interface JiraService
Returns:
A HTML description of the service

hasProperty

public boolean hasProperty(java.lang.String propertyKey)
                    throws ObjectConfigurationException
Throws:
ObjectConfigurationException

getProperty

public java.lang.String getProperty(java.lang.String propertyKey)
                             throws ObjectConfigurationException
Throws:
ObjectConfigurationException

getLongProperty

public java.lang.Long getLongProperty(java.lang.String propertyKey)
                               throws ObjectConfigurationException
Throws:
ObjectConfigurationException

getDefaultProperty

public java.lang.String getDefaultProperty(java.lang.String propertyKey)
                                    throws ObjectConfigurationException
Throws:
ObjectConfigurationException

getProperties

public PropertySet getProperties()
                          throws ObjectConfigurationException
Throws:
ObjectConfigurationException

getObjectConfiguration

protected ObjectConfiguration getObjectConfiguration(java.lang.String id,
                                                     java.lang.String xmlfile,
                                                     java.util.Map params)
                                              throws ObjectConfigurationException
Throws:
ObjectConfigurationException