@PublicSpi public abstract class AbstractService extends Object implements JiraService
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.log4j.Logger |
log |
protected String |
name |
static String |
SERVICE_EVENT |
NAME_COMPARATOR| Constructor and Description |
|---|
AbstractService() |
| Modifier and Type | Method and Description |
|---|---|
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)
Returns the default property value for a key
|
String |
getDescription()
A textual description of the service.
|
String |
getKey()
Return the key of this object
|
Long |
getLongProperty(String propertyKey)
Returns a property of this object with the specified key as a long
|
String |
getName()
A textual name of the service as entered by the user from the web interface.
|
protected ObjectConfiguration |
getObjectConfiguration(String id,
String xmlfile,
Map<String,String[]> params) |
com.opensymphony.module.propertyset.PropertySet |
getProperties()
Retrieve all the specified Properties for this object
|
String |
getProperty(String propertyKey)
Returns a property of this object with the specified key
|
String |
getTextProperty(String propertyKey)
Returns a property of this object with the specified key, the property is of type text
|
boolean |
hasProperty(String propertyKey)
Checks if this object has a particular property
|
void |
init(com.opensymphony.module.propertyset.PropertySet props)
Initialise the service.
|
boolean |
isInternal()
By default, returns false.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitgetObjectConfigurationpublic static final String SERVICE_EVENT
protected org.apache.log4j.Logger log
protected String name
public abstract void run()
run in interface JiraServicerun in interface RunnableJiraService.init(com.opensymphony.module.propertyset.PropertySet)public void init(com.opensymphony.module.propertyset.PropertySet props)
throws ObjectConfigurationException
JiraServiceAs 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.
init in interface JiraServiceprops - initialisation parametersObjectConfigurationException - in case of an error with initialisation parametersJiraService.init(PropertySet, long)public void destroy()
You may wish to remove any connections that you have established, eg. database connections.
destroy in interface JiraServicepublic boolean isInternal()
isInternal in interface JiraServicepublic String getKey()
ObjectConfigurablegetKey in interface ObjectConfigurablepublic boolean isUnique()
isUnique in interface JiraServicepublic String getDescription()
JiraServiceA 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.
getDescription in interface JiraServicepublic boolean hasProperty(String propertyKey) throws ObjectConfigurationException
ObjectConfigurablehasProperty in interface ObjectConfigurablepropertyKey - to look forObjectConfigurationExceptionpublic String getProperty(String propertyKey) throws ObjectConfigurationException
ObjectConfigurablegetProperty in interface ObjectConfigurablepropertyKey - String key used to retrieve the property valueObjectConfigurationExceptionpublic String getTextProperty(String propertyKey) throws ObjectConfigurationException
ObjectConfigurablegetTextProperty in interface ObjectConfigurablepropertyKey - String key used to retrieve the property valueObjectConfigurationExceptionpublic Long getLongProperty(String propertyKey) throws ObjectConfigurationException
ObjectConfigurablegetLongProperty in interface ObjectConfigurablepropertyKey - String key used to retrieve the property valueObjectConfigurationExceptionpublic String getDefaultProperty(String propertyKey) throws ObjectConfigurationException
ObjectConfigurablegetDefaultProperty in interface ObjectConfigurablepropertyKey - String key used to retrieve the properties default valueObjectConfigurationExceptionpublic com.opensymphony.module.propertyset.PropertySet getProperties()
throws ObjectConfigurationException
ObjectConfigurablegetProperties in interface ObjectConfigurableObjectConfigurationExceptionprotected ObjectConfiguration getObjectConfiguration(String id, String xmlfile, Map<String,String[]> params) throws ObjectConfigurationException
ObjectConfigurationExceptionpublic String getName()
JiraService
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
getName in interface JiraServicepublic void setName(String name)
JiraServiceJiraService.getName()setName in interface JiraServicename - service name to setCopyright © 2002-2019 Atlassian. All Rights Reserved.