public class UnloadableJiraServiceContainer extends Object implements JiraServiceContainer
NAME_COMPARATOR
Constructor and Description |
---|
UnloadableJiraServiceContainer(Long id,
String name,
String clazz,
long delay,
String cronExpression) |
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 |
getCronExpression()
Get the cron expression.
|
String |
getDefaultProperty(String propertyKey)
Returns the default property value for a key
|
long |
getDelay()
Get the delay time for this service.
|
String |
getDescription()
A textual description of the service.
|
Long |
getId() |
String |
getKey()
Return the key of this object
|
long |
getLastRun() |
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.
|
ObjectConfiguration |
getObjectConfiguration()
Retrieves an object configuration object with properties that can be set
|
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 |
getServiceClass() |
Class |
getServiceClassObject() |
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 |
isDueAt(long time)
Is this service due to run at the specified time.
|
boolean |
isInternal()
Indicates whether administrators can delete this service from within the web interface.
|
boolean |
isLocalService()
Returns true if in a clustered environment this service should run locally on every node.
|
boolean |
isRunning() |
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 |
setLastRun()
Record when run.
|
void |
setName(String name)
Used to set the service's name.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
init
public 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 JiraService
public void setName(String name)
JiraService
JiraService.getName()
setName
in interface JiraService
name
- service name to setpublic long getDelay()
JiraServiceContainer
getDelay
in interface JiraServiceContainer
public void setDelay(long delay)
JiraServiceContainer
setDelay
in interface JiraServiceContainer
public String getCronExpression()
JiraServiceContainer
getCronExpression
in interface JiraServiceContainer
public void setCronExpression(String cronExpression)
JiraServiceContainer
setCronExpression
in interface JiraServiceContainer
cronExpression
- Cron Expressionpublic String getServiceClass()
getServiceClass
in interface JiraServiceContainer
public Class getServiceClassObject()
getServiceClassObject
in interface JiraServiceContainer
public boolean isLocalService()
JiraServiceContainer
isLocalService
in interface JiraServiceContainer
public boolean isUsable()
isUsable
in interface JiraServiceContainer
public Long getId()
getId
in interface JiraServiceContainer
public boolean isDueAt(long time)
JiraServiceContainer
isDueAt
in interface JiraServiceContainer
time
- the time to check whether it is due.public long getLastRun()
getLastRun
in interface JiraServiceContainer
public void setLastRun()
JiraServiceContainer
setLastRun
in interface JiraServiceContainer
public boolean isRunning()
isRunning
in interface JiraServiceContainer
public void init(com.opensymphony.module.propertyset.PropertySet props) throws ObjectConfigurationException
JiraService
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.
init
in interface JiraService
props
- initialisation parametersObjectConfigurationException
- in case of an error with initialisation parametersJiraService.init(PropertySet, long)
public void run()
JiraService
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.
run
in interface JiraService
run
in interface Runnable
JiraService.init(com.opensymphony.module.propertyset.PropertySet)
public void destroy()
JiraService
You may wish to remove any connections that you have established, eg. database connections.
destroy
in interface JiraService
public boolean isInternal()
JiraService
Generally only Atlassian services should return true from this.
isInternal
in interface JiraService
public boolean isUnique()
JiraService
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
isUnique
in interface JiraService
public String getDescription()
JiraService
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.
getDescription
in interface JiraService
public ObjectConfiguration getObjectConfiguration() throws ObjectConfigurationException
ObjectConfigurable
getObjectConfiguration
in interface ObjectConfigurable
ObjectConfigurationException
public boolean hasProperty(String propertyKey) throws ObjectConfigurationException
ObjectConfigurable
hasProperty
in interface ObjectConfigurable
propertyKey
- to look forObjectConfigurationException
public String getProperty(String propertyKey) throws ObjectConfigurationException
ObjectConfigurable
getProperty
in interface ObjectConfigurable
propertyKey
- String key used to retrieve the property valueObjectConfigurationException
public String getTextProperty(String propertyKey) throws ObjectConfigurationException
ObjectConfigurable
getTextProperty
in interface ObjectConfigurable
propertyKey
- String key used to retrieve the property valueObjectConfigurationException
public Long getLongProperty(String propertyKey) throws ObjectConfigurationException
ObjectConfigurable
getLongProperty
in interface ObjectConfigurable
propertyKey
- String key used to retrieve the property valueObjectConfigurationException
public String getDefaultProperty(String propertyKey) throws ObjectConfigurationException
ObjectConfigurable
getDefaultProperty
in interface ObjectConfigurable
propertyKey
- String key used to retrieve the properties default valueObjectConfigurationException
public com.opensymphony.module.propertyset.PropertySet getProperties() throws ObjectConfigurationException
ObjectConfigurable
getProperties
in interface ObjectConfigurable
ObjectConfigurationException
public String getKey()
ObjectConfigurable
getKey
in interface ObjectConfigurable
Copyright © 2002-2021 Atlassian. All Rights Reserved.