Class UnloadableJiraServiceContainer
- All Implemented Interfaces:
ObjectConfigurable
,JiraService
,JiraServiceContainer
,Runnable
-
Field Summary
Fields inherited from interface com.atlassian.jira.service.JiraService
NAME_COMPARATOR
-
Constructor Summary
ConstructorsConstructorDescriptionUnloadableJiraServiceContainer
(Long id, String name, String clazz, long delay, String cronExpression) -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
This method is called when the service is unloaded (usually when the web application or server is being shut down).Get the cron expression.getDefaultProperty
(String propertyKey) Returns the default property value for a keylong
getDelay()
Get the delay time for this service.A textual description of the service.getId()
getKey()
Return the key of this objectlong
getLongProperty
(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.Retrieves an object configuration object with properties that can be setcom.opensymphony.module.propertyset.PropertySet
Retrieve 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 textboolean
hasProperty
(String propertyKey) Checks if this object has a particular propertyvoid
init
(com.opensymphony.module.propertyset.PropertySet props) Initialise the service.boolean
isDueAt
(long time) Is this service due to run at the specified time.boolean
Indicates whether administrators can delete this service from within the web interface.boolean
Returns true if in a clustered environment this service should run locally on every node.boolean
boolean
isUnique()
Whether this service class should be unique.boolean
isUsable()
void
run()
Perform the action of this service.void
setCronExpression
(String cronExpression) Set the cron expression.void
setDelay
(long delay) Set the delay time for this service.void
Record when run.void
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.jira.service.JiraService
init
-
Constructor Details
-
UnloadableJiraServiceContainer
-
-
Method Details
-
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 interfaceJiraService
- Returns:
- The name of the service
-
setName
Description copied from interface:JiraService
Used to set the service's name. For details on the services name seeJiraService.getName()
- Specified by:
setName
in interfaceJiraService
- Parameters:
name
- service name to set
-
getDelay
public long getDelay()Description copied from interface:JiraServiceContainer
Get the delay time for this service. Values invalid input: '<' 0 indicate this delay is not used. (For backward compatibility with the interface). The delay value will only be used if a Cron Expression is not supplied.- Specified by:
getDelay
in interfaceJiraServiceContainer
- Returns:
- the interval delay for scheduling the service
-
setDelay
public void setDelay(long delay) Description copied from interface:JiraServiceContainer
Set the delay time for this service. Values invalid input: '<' 0 indicate this delay is not used. (For backward compatibility with the interface). The delay value will only be used if a Cron Expression is not supplied.- Specified by:
setDelay
in interfaceJiraServiceContainer
-
getCronExpression
Description copied from interface:JiraServiceContainer
Get the cron expression.- Specified by:
getCronExpression
in interfaceJiraServiceContainer
- Returns:
- cron Cron Expression
-
setCronExpression
Description copied from interface:JiraServiceContainer
Set the cron expression.- Specified by:
setCronExpression
in interfaceJiraServiceContainer
- Parameters:
cronExpression
- Cron Expression
-
getServiceClass
- Specified by:
getServiceClass
in interfaceJiraServiceContainer
-
getServiceClassObject
- Specified by:
getServiceClassObject
in interfaceJiraServiceContainer
- Returns:
- the Class object of the underlying service, or null if service could not be loaded
-
isLocalService
public boolean isLocalService()Description copied from interface:JiraServiceContainer
Returns true if in a clustered environment this service should run locally on every node.- Specified by:
isLocalService
in interfaceJiraServiceContainer
- Returns:
- true if in a clustered environment this service should run locally on every node.
-
isUsable
public boolean isUsable()- Specified by:
isUsable
in interfaceJiraServiceContainer
-
getId
- Specified by:
getId
in interfaceJiraServiceContainer
-
isDueAt
public boolean isDueAt(long time) Description copied from interface:JiraServiceContainer
Is this service due to run at the specified time.- Specified by:
isDueAt
in interfaceJiraServiceContainer
- Parameters:
time
- the time to check whether it is due.- Returns:
- true if due.
-
getLastRun
public long getLastRun()- Specified by:
getLastRun
in interfaceJiraServiceContainer
-
setLastRun
public void setLastRun()Description copied from interface:JiraServiceContainer
Record when run.- Specified by:
setLastRun
in interfaceJiraServiceContainer
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceJiraServiceContainer
-
init
public void init(com.opensymphony.module.propertyset.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 interfaceJiraService
- Parameters:
props
- initialisation parameters- Throws:
ObjectConfigurationException
- in case of an error with initialisation parameters- See Also:
-
run
public void run()Description copied from interface:JiraService
Perform the action of this service. The caller of this method assumes that no housekeeping has been done, and will call setLastRun() after the run() method.init() is guaranteed to be called before run(), but the parameters passed to init() are not guaranteed to be correct. Any parameters expected to be set by init() should be checked in this method upon each invocation.
- Specified by:
run
in interfaceJiraService
- Specified by:
run
in interfaceRunnable
- See Also:
-
destroy
public void destroy()Description copied from interface:JiraService
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 interfaceJiraService
-
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 interfaceJiraService
- Returns:
- true if this service is internal to JIRA, false otherwise
-
isUnique
public boolean isUnique()Description copied from interface:JiraService
Whether this service class should be unique. Some service are fine to have multiples, and some are not.Having multiple backup services could be fine - perhaps you want to backup once an hour, and also once a day.
With other services, you may wish to enforce their uniqueness
- Specified by:
isUnique
in interfaceJiraService
- Returns:
- Whether this service class should be unique.
-
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 interfaceJiraService
- Returns:
- A HTML description of the service
-
getObjectConfiguration
Description copied from interface:ObjectConfigurable
Retrieves an object configuration object with properties that can be set- Specified by:
getObjectConfiguration
in interfaceObjectConfigurable
- Returns:
- ObjectConfiguration object
- Throws:
ObjectConfigurationException
-
hasProperty
Description copied from interface:ObjectConfigurable
Checks if this object has a particular property- Specified by:
hasProperty
in interfaceObjectConfigurable
- Parameters:
propertyKey
- to look for- Returns:
- true If there is a value
- Throws:
ObjectConfigurationException
-
getProperty
Description copied from interface:ObjectConfigurable
Returns a property of this object with the specified key- Specified by:
getProperty
in interfaceObjectConfigurable
- Parameters:
propertyKey
- String key used to retrieve the property value- Returns:
- Property value
- Throws:
ObjectConfigurationException
-
getTextProperty
Description copied from interface:ObjectConfigurable
Returns a property of this object with the specified key, the property is of type text- Specified by:
getTextProperty
in interfaceObjectConfigurable
- Parameters:
propertyKey
- String key used to retrieve the property value- Returns:
- Property value
- Throws:
ObjectConfigurationException
-
getLongProperty
Description copied from interface:ObjectConfigurable
Returns a property of this object with the specified key as a long- Specified by:
getLongProperty
in interfaceObjectConfigurable
- Parameters:
propertyKey
- String key used to retrieve the property value- Returns:
- Property value
- Throws:
ObjectConfigurationException
-
getDefaultProperty
Description copied from interface:ObjectConfigurable
Returns the default property value for a key- Specified by:
getDefaultProperty
in 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:ObjectConfigurable
Retrieve all the specified Properties for this object- Specified by:
getProperties
in interfaceObjectConfigurable
- Returns:
- Set of properties for this object
- Throws:
ObjectConfigurationException
-
getKey
Description copied from interface:ObjectConfigurable
Return the key of this object- Specified by:
getKey
in interfaceObjectConfigurable
- Returns:
- Key of object
-