com.atlassian.jira.service
Class AbstractService

java.lang.Object
  extended by com.atlassian.jira.service.AbstractService
All Implemented Interfaces:
com.atlassian.configurable.ObjectConfigurable, 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  org.apache.log4j.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.String getKey()
           
 java.lang.Long getLongProperty(java.lang.String propertyKey)
           
protected  com.atlassian.configurable.ObjectConfiguration getObjectConfiguration(java.lang.String id, java.lang.String xmlfile, java.util.Map params)
           
 com.opensymphony.module.propertyset.PropertySet getProperties()
           
 java.lang.String getProperty(java.lang.String propertyKey)
           
 boolean hasProperty(java.lang.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.
 
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 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(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 java.lang.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 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 com.atlassian.configurable.ObjectConfigurationException
Specified by:
hasProperty in interface com.atlassian.configurable.ObjectConfigurable
Throws:
com.atlassian.configurable.ObjectConfigurationException

getProperty

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

getLongProperty

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

getDefaultProperty

public java.lang.String getDefaultProperty(java.lang.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(java.lang.String id,
                                                                                java.lang.String xmlfile,
                                                                                java.util.Map params)
                                                                         throws com.atlassian.configurable.ObjectConfigurationException
Throws:
com.atlassian.configurable.ObjectConfigurationException


Copyright © 2002-2006 Atlassian. All Rights Reserved.