com.atlassian.jira.service
Class AbstractService

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

public abstract class AbstractService
extends Object
implements JiraService

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


Field Summary
protected  org.apache.log4j.Category log
           
protected  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).
 String getDefaultProperty(String propertyKey)
           
 String getDescription()
          A textual description of the service.
 String getKey()
           
 Long getLongProperty(String propertyKey)
           
 String getName()
          A textual name of the service as entered by the user from the web interface.
protected  com.atlassian.configurable.ObjectConfiguration getObjectConfiguration(String id, String xmlfile, Map params)
           
 com.opensymphony.module.propertyset.PropertySet getProperties()
           
 String getProperty(String propertyKey)
           
 String getTextProperty(String propertyKey)
           
 boolean hasProperty(String propertyKey)
           
 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()
          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.
 void setName(String name)
          Used to set the service's name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.configurable.ObjectConfigurable
getObjectConfiguration
 

Field Detail

log

protected org.apache.log4j.Category log

name

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

init

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

getKey

public String getKey()
Specified by:
getKey in interface com.atlassian.configurable.ObjectConfigurable

isUnique

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

Specified by:
isUnique in interface JiraService
Returns:
false.

getDescription

public 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(String propertyKey)
                    throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
hasProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getProperty

public String getProperty(String propertyKey)
                   throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getTextProperty

public String getTextProperty(String propertyKey)
                       throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getTextProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getLongProperty

public Long getLongProperty(String propertyKey)
                     throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getLongProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getDefaultProperty

public String getDefaultProperty(String propertyKey)
                          throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getDefaultProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getProperties

public com.opensymphony.module.propertyset.PropertySet getProperties()
                                                              throws com.atlassian.configurable.ObjectConfigurationException
Specified by:
getProperties in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getObjectConfiguration

protected com.atlassian.configurable.ObjectConfiguration getObjectConfiguration(String id,
                                                                                String xmlfile,
                                                                                Map params)
                                                                         throws com.atlassian.configurable.ObjectConfigurationException
Throws:
com.atlassian.configurable.ObjectConfigurationException

getName

public String getName()
Description copied from interface: JiraService
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

Specified by:
getName in interface JiraService
Returns:
The name of the service

setName

public void setName(String name)
Description copied from interface: JiraService
Used to set the service's name. For details on the services name see JiraService.getName()

Specified by:
setName in interface JiraService


Copyright © 2002-2006 Atlassian. All Rights Reserved.