Package com.atlassian.jira.service
Class AbstractService
java.lang.Object
com.atlassian.jira.service.AbstractService
- All Implemented Interfaces:
ObjectConfigurable,JiraService,Runnable
- Direct Known Subclasses:
AbstractMessageHandlingService,AuditLogCleaningService,CacheFlusher,ClusterMessageCleaningService,DebugService,ExportService,ImapService,IndexSnapshotService,JiraHomeReplicatorService,MailQueueService,NodeStateCheckerService,PopService,ReplicatedIndexCleaningService
A convenience class - if you extend this class, all that needs to be implemented is run()
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.log4j.Loggerprotected Stringstatic final StringFields inherited from interface com.atlassian.jira.service.JiraService
NAME_COMPARATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()This method is called when the service is unloaded (usually when the web application or server is being shut down).getDefaultProperty(String propertyKey) Returns the default property value for a keyA textual description of the service.getKey()Return the key of this objectgetLongProperty(String propertyKey) Returns a property of this object with the specified key as a longgetName()A textual name of the service as entered by the user from the web interface.protected ObjectConfigurationcom.opensymphony.module.propertyset.PropertySetRetrieve all the specified Properties for this objectgetProperty(String propertyKey) Returns a property of this object with the specified keygetTextProperty(String propertyKey) Returns a property of this object with the specified key, the property is of type textbooleanhasProperty(String propertyKey) Checks if this object has a particular propertyvoidinit(com.opensymphony.module.propertyset.PropertySet props) Initialise the service.booleanBy default, returns false.booleanisUnique()By default, services are not unique.abstract voidrun()This method must be implemented in a subclass, and performs the functionality that the service performs.voidUsed to set the service's name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.jira.service.JiraService
initMethods inherited from interface com.atlassian.configurable.ObjectConfigurable
getObjectConfiguration
-
Field Details
-
SERVICE_EVENT
- See Also:
-
log
protected org.apache.log4j.Logger log -
name
-
-
Constructor Details
-
AbstractService
public AbstractService()
-
-
Method Details
-
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:
runin interfaceJiraService- Specified by:
runin interfaceRunnable- See Also:
-
init
public void init(com.opensymphony.module.propertyset.PropertySet props) throws ObjectConfigurationException Description copied from interface:JiraServiceInitialise 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:
initin interfaceJiraService- Parameters:
props- initialisation parameters- Throws:
ObjectConfigurationException- in case of an error with initialisation parameters- See Also:
-
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:
destroyin interfaceJiraService
-
isInternal
public boolean isInternal()By default, returns false.- Specified by:
isInternalin interfaceJiraService- Returns:
- false
-
getKey
Description copied from interface:ObjectConfigurableReturn the key of this object- Specified by:
getKeyin interfaceObjectConfigurable- Returns:
- Key of object
-
isUnique
public boolean isUnique()By default, services are not unique.- Specified by:
isUniquein interfaceJiraService- Returns:
- false.
-
getDescription
Description copied from interface:JiraServiceA 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:
getDescriptionin interfaceJiraService- Returns:
- A HTML description of the service
-
hasProperty
Description copied from interface:ObjectConfigurableChecks if this object has a particular property- Specified by:
hasPropertyin interfaceObjectConfigurable- Parameters:
propertyKey- to look for- Returns:
- true If there is a value
- Throws:
ObjectConfigurationException
-
getProperty
Description copied from interface:ObjectConfigurableReturns a property of this object with the specified key- Specified by:
getPropertyin interfaceObjectConfigurable- Parameters:
propertyKey- String key used to retrieve the property value- Returns:
- Property value
- Throws:
ObjectConfigurationException
-
getTextProperty
Description copied from interface:ObjectConfigurableReturns a property of this object with the specified key, the property is of type text- Specified by:
getTextPropertyin interfaceObjectConfigurable- Parameters:
propertyKey- String key used to retrieve the property value- Returns:
- Property value
- Throws:
ObjectConfigurationException
-
getLongProperty
Description copied from interface:ObjectConfigurableReturns a property of this object with the specified key as a long- Specified by:
getLongPropertyin interfaceObjectConfigurable- Parameters:
propertyKey- String key used to retrieve the property value- Returns:
- Property value
- Throws:
ObjectConfigurationException
-
getDefaultProperty
Description copied from interface:ObjectConfigurableReturns the default property value for a key- Specified by:
getDefaultPropertyin interfaceObjectConfigurable- Parameters:
propertyKey- String key used to retrieve the properties default value- Returns:
- Default property key
- Throws:
ObjectConfigurationException
-
getProperties
public com.opensymphony.module.propertyset.PropertySet getProperties() throws ObjectConfigurationExceptionDescription copied from interface:ObjectConfigurableRetrieve all the specified Properties for this object- Specified by:
getPropertiesin interfaceObjectConfigurable- Returns:
- Set of properties for this object
- Throws:
ObjectConfigurationException
-
getObjectConfiguration
protected ObjectConfiguration getObjectConfiguration(String id, String xmlfile, Map<String, String[]> params) throws ObjectConfigurationException- Throws:
ObjectConfigurationException
-
getName
Description copied from interface:JiraServiceA 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:
getNamein interfaceJiraService- Returns:
- The name of the service
-
setName
Description copied from interface:JiraServiceUsed to set the service's name. For details on the services name seeJiraService.getName()- Specified by:
setNamein interfaceJiraService- Parameters:
name- service name to set
-